Results 1 to 3 of 3

Thread: NuSOAP, ASP, and PHP

  1. #1
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default NuSOAP, ASP, and PHP

    Is anybody here familiar with NuSOAP?

    Well, this is my connundrum: I'm trying to access an xml web service from a company that has the worst customer service known to man. The only information I got from them was that the response will be in xml. Thereby leaving it up to me to be creative and get this response. I tried NuSOAP, but I keep getting an error message back from them that looks like this:

    Code:
    <HTML>
    <BODY>
    <Response><ErrorCode>200</ErrorCode><ErrorText>Not a valid request</ErrorText></Response>
    and that doesn't fricking look like xml to me. No delcaration, and two open html and body tags. When I alerted them to it, they said "other people have gotten it to work."

    I think part of the problem is that I build in php because my server is not asp enabled (and because i don't know asp) but their service is an asp file. Does anybody have any ideas?

    Thanks.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I think part of the problem is that I build in php because my server is not asp enabled (and because i don't know asp) but their service is an asp file.
    It shouldn't be.
    and that doesn't fricking look like xml to me. No delcaration, and two open html and body tags.
    No, but it does look like an attempt at XML written by an idiot

    How do you access it? Can you provide the code you used to generate the request?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    It shouldn't be.No, but it does look like an attempt at XML written by an idiot

    How do you access it? Can you provide the code you used to generate the request?
    Here's the php file:

    PHP Code:
    <?php
    /*
     *    $Id: wsdlclient3b.php,v 1.1 2004/06/15 15:38:29 snichol Exp $
     *
     *    WSDL client sample.
     *
     *    Service: WSDL
     *    Payload: rpc/encoded (params as an XML string; cf. wsdlclient3.php)
     *    Transport: http
     *    Authentication: none
     */
    require_once('../lib/nusoap.php');
    $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
    $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
    $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
    $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
    $client = new soapclient('http://Kunaki.com/XMLService.ASP'false,
                            
    $proxyhost$proxyport$proxyusername$proxypassword);
    $err $client->getError();
    if (
    $err) {
        echo 
    '<h2>Constructor error</h2><pre>' $err '</pre>';
    }

    $params file_get_contents("http://musicstore.jasonkosi.com/xml_temp_4.xml");

    $result $client->call('ShippingOptions'$params$namespace'ShippingOptions');
    // Check for a fault
    if ($client->fault) {
        echo 
    '<h2>Fault</h2><pre>';
        
    print_r($result);
        echo 
    '</pre>';
    } else {
        
    // Check for errors
        
    $err $client->getError();
        if (
    $err) {
            
    // Display the error
            
    echo '<h2>Error</h2><pre>' $err '</pre>';
        } else {
            
    // Display the result
            
    echo '<h2>Result</h2><pre>';
            
    print_r($result);
            echo 
    '</pre>';
        }
    }

    echo 
    '<h2>Request</h2><pre>' htmlspecialchars($client->requestENT_QUOTES) . '</pre>';

    echo 
    '<h2>Response</h2><pre>' htmlspecialchars($client->responseENT_QUOTES) . '</pre>';

    echo 
    '<h2>Debug</h2><pre>' htmlspecialchars($client->debug_strENT_QUOTES) . '</pre>';
    ?>
    And here's the xml inlclude:

    Code:
    <Country>United States</Country>
    <state_Province>NY</state_Province>
    <PostalCode>10004</PostalCode>
    <Product>
         <ProductId>XZZ1111111</ProductId>
         <Quantity>2</Quantity>
    </Product>
    <Product>
         <ProductId>PXZZ111112</ProductId>
         <Quantity>3</Quantity>
    </Product>
    The request is sent with the nusoap library and looks like this:

    Code:
    POST /XMLService.ASP HTTP/1.0
    Host: Kunaki.com
    User-Agent: NuSOAP/0.7.2 (1.94)
    Content-Type: text/xml; charset=ISO-8859-1
    SOAPAction: "ShippingOptions"
    Content-Length: 707
    
    <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ShippingOptions><Country>United States</Country>
    <state_Province>NY</state_Province>
    <PostalCode>10004</PostalCode>
    <Product>
         <ProductId>XZZ1111111</ProductId>
         <Quantity>2</Quantity>
    </Product>
    <Product>
         <ProductId>PXZZ111112</ProductId>
         <Quantity>3</Quantity>
    </Product></ShippingOptions></SOAP-ENV:Body></SOAP-ENV:Envelope>
    and the response looks like this:

    Code:
    HTTP/1.1 200 OK
    Connection: close
    Date: Fri, 06 Apr 2007 20:51:59 GMT
    Server: Microsoft-IIS/6.0
    Content-Length: 109
    Content-Type: text/xml
    Expires: Fri, 06 Apr 2007 04:11:59 GMT
    Set-Cookie: ASPSESSIONIDCQRDQRCS=KOIHNPDDPNHDGNHIEEDEIMGH; path=/
    Cache-control: private
    
    
    <HTML>
    <BODY>
    <Response><ErrorCode>200</ErrorCode><ErrorText>Not a valid request</ErrorText></Response>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •