SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,290
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)

    SOAP Client Question

    I'm having a problem which I don't understand. I'm trying to implement a SOAP call to an external entity for a client and I'm running into an issue....

    I'm making the soap client call pretty much the standard way (at least from any permutation I can find.....)
    Code PHP:
            $client = new SoapClient('http://store.example.com/dirName/WebService.asmx?WSDL');
            $response = $client->__soapCall('MethodName', array("Attribute1" => "value1", "Attribute2" => "value2"));

    But when I execute it, I get the following error...
    Code:
    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: Attribute1 and Attribute2 are required
    at dbReg.DataWebService.MethodName(String Attribute1, String Attribute2)
    --- End of inner exception stack trace ---
    here is the appropriate section of the wsdl

    Code:
    - <s:element name="MethodName"> - <s:complexType>
    - <s:sequence>
     <s:element minOccurs="0" maxOccurs="1" name="Attribute1" type="s:string" /> 
    
     <s:element minOccurs="0" maxOccurs="1" name="Attribute2" type="s:string" /> 
    
     </s:sequence>
    
    
     </s:complexType>
    
    
     </s:element>
    
    I've also tried using $client->__call('MethodName', array("Attribute1" => "value1", "Attribute2" => "value2")); and $client->MethodName(array("Attribute1" => "value1", "Attribute2" => "value2")); (which basically generates the __soapCall call systematically) and get the same results.

    This is the first time I've done SOAP via php (I've done it with .net, java and classic asp), but I'm not sure what I'm missing. What should be my first steps in debugging this?
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    $response = $client->MethodName(array("Attribute1" => "value1", "Attribute2" => "value2"));


    I did not see that you have already tried that.

    In this case try to wrap your arguments in another array(), like this:

    $response = $client->__soapCall('MethodName', array(array("Attribute1" => "value1", "Attribute2" => "value2") ));

    It may work, I'm not sure, but I think I've had a similar problem and it worked for me

  3. #3
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,290
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ultra1 View Post
    Try this:
    $response = $client->MethodName(array("Attribute1" => "value1", "Attribute2" => "value2"));
    Grrr.....I know I tried this (both with and without the array), and it didn't work before, but now it does..... *sigh*. Thanks for the heads up.
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse


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
  •