Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trouble consuming a .NET web service with nuSOAP

    I am trying to consume a web service and am faced with this fault:

    soapclient: got wsdl error: phpType is struct, but value is not an array: see debug output for details


    My script is below;

    <?php
    require_once('nusoap.php') ;
    $client = new soapclient('http://www.regonline.com/webservices/RetrieveSingleRegistration.asmx?wsdl' , true ) ;
    $msg = '
    <RetrieveSingleRegistration xmlns="http://www.regonline.com/webservices/">
    <customerUserName>pk4u</customerUserName>
    <customerPassword>x9ja9j</customerPassword>
    <eventID>344</eventID>
    <registrationID>3795103</registrationID>
    </RetrieveSingleRegistration>
    ';

    $ns = "http://www.regonline.com/webservices/";

    $soapaction = "http://www.regonline.com/webservices/RetrieveSingleRegistration";

    $response = $client->call( "RetrieveSingleRegistration" , array($msg), $ns, $soapaction ) ;

    echo '<h2>Request</h2>';
    echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
    echo '<h2>Response</h2>';
    echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
    echo '<h2>Debug</h2>';
    echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';

    if ( isset( $fault ) ) {
    print "Error: ". $fault;
    }else{
    print "no errors";
    }
    echo "<br /> <br />Response: " . $response ;
    unset($client);
    ?>

    Does anyone have a clue what I'm doing wrong?

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It sounds like a parsing problem with the WSDL file itself. Have you considered trying PHP's built in SoapClient? (although you will need PHP 5)

  • #3
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have tried it that way, at least I think so and it appears the values passed are read as NULL on the .NET service

  • #4
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A little further

    The web service apparently gets and successfully reads the passed values, but errors on the response attempt with this message:

    soapclient: got wsdl error: phpType is struct, but value is not an array

  • #5
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,169
    Thanks
    19
    Thanked 65 Times in 64 Posts
    I had problems with nuSoap and it wanting arrays instead of xml. So I use send() instead and just send the full xml data
    eg
    PHP Code:

    $msg 
    '
    ?xml version="1.0" encoding="ISO-8859-1"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <RetrieveSingleRegistration xmlns="http://www.regonline.com/webservices/">
    <customerUserName>pk4u</customerUserName>
    <customerPassword>x9ja9j</customerPassword>
    <eventID>344</eventID>
    <registrationID>3795103</registrationID>
    </RetrieveSingleRegistration>
    </soap:Body>
    </soap:Envelope>
    '
    ;

    $soapclient = new nuSoapclient('http://www.regonline.com/webservices/RetrieveSingleRegistration.asmx');

    $soapclient->send($msg"http://www.regonline.com/webservices/RetrieveSingleRegistration");
    $response $soapclient->response 

  • #6
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i also fear you wount be able to fully use the nusoap, and will need to do some of the envelop composing by hand.

    check out http://users.skynet.be/pascalbotte/r...apadvanced.htm for an example
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

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