Results 1 to 4 of 4

Thread: Calling a function from a client Web Service

  1. #1
    Join Date
    Jul 2009
    Posts
    77

    Calling a function from a client Web Service

    I recently started in web services. I have a web service that implements 2 functions defined in the wsdl and the corresponding PHP class. When I call $mySoapClient->__getFunctions(), I found out 2 functions in question, with good returns and good settings.

    But I call:
    • $mySoapClient-> function1 (...)
    • $mySoapClient-> function2 (...)
    • $mySoapClient-> __soapCall ( 'function1', array (...))
    • $mySoapClient-> __soapCall ( 'function2', array (...))


    Function1 is still being evaluated and no way to enforce function2

    In this case, when I call $mySoapClient->__getLastRequest(), I see an application where the function name never appears (no "SOAPAction" and therefore no "function1" or "function2" inside) and only the parameters of the function I call appear. Is there some problem with my function call to web service?

  2. #2
    Join Date
    Nov 2008
    Posts
    1,192

    Re: Calling a function from a client Web Service

    Can you provide us the web service code? Because without that it would be very difficult (almost difficult) for anyone to solve your problem!

  3. #3
    Join Date
    Jul 2009
    Posts
    77

    Re: Calling a function from a client Web Service

    I apologize for my mistake!

    I must had added that initially, by exchanging the order of statements 2 functions in the binding was only the function2 that was running, and when I tried to call function1, it made me crash, then restart Apache .

    Here's the code:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
     xmlns:tns="http://plopInc/Plopservice" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://plopInc/Plopservice">
     
     <wsdl:types>
      <schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
       xmlns:tns="http://plopInc/Plopservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       targetNamespace="http://plopInc/Plopservice">
     
       <simpleType name="EnumerationStatus">
        <xsd:restriction base="xsd:string">
         <xsd:enumeration value="Success" />
         <xsd:enumeration value="Warning" />
         <xsd:enumeration value="Failure" />
        </xsd:restriction>
       </simpleType>
     
       <complexType name="serviceReturn">
        <sequence>
         <element minOccurs="1" maxOccurs="1" name="status"
          type="tns:EnumerationStatus" />
         <element minOccurs="0" maxOccurs="1" name="code" type="xsd:string" />
         <element minOccurs="0" maxOccurs="1" name="message" type="xsd:string" />
        </sequence>
       </complexType>
     
       <!--
        ******************************************************************************
       -->
     
       <complexType name="Contact">
        <sequence>
         <element minOccurs="0" maxOccurs="1" name="id" type="xsd:long" />
         <element minOccurs="1" maxOccurs="1" name="name" type="xsd:string" />
         <element minOccurs="1" maxOccurs="1" name="prename" type="xsd:string" />
         <element minOccurs="0" maxOccurs="1" name="listTelephones"
          type="tns:ListTelephones" />
        </sequence>
       </complexType>
     
       <complexType name="ListContacts">
        <sequence>
         <element minOccurs="0" maxOccurs="unbounded" name="Contact"
          nillable="true" type="tns:Contact" />
        </sequence>
       </complexType>
     
       <complexType name="Telephone">
        <sequence>
         <element minOccurs="0" maxOccurs="1" name="label" type="xsd:string" />
         <element minOccurs="0" maxOccurs="1" name="numeral" type="xsd:string" />
        </sequence>
       </complexType>
     
       <complexType name="ListTelephones">
        <sequence>
         <element minOccurs="0" maxOccurs="unbounded" name="Telephone"
          nillable="true" type="tns:Telephone" />
        </sequence>
       </complexType>
     
       <!--
        ******************************************************************************
       -->
     
       <element name="SearchContactResponse">
        <complexType>
         <sequence>
          <element minOccurs="1" maxOccurs="1" name="serviceReturn"
           type="tns:serviceReturn" />
          <element minOccurs="0" maxOccurs="1" name="listContacts"
           type="tns:ListContacts" />
         </sequence>
        </complexType>
       </element>
     
       <element name="UpdateContactResponse">
        <complexType>
         <sequence>
          <element minOccurs="1" maxOccurs="1" name="serviceReturn"
           type="tns:serviceReturn" />
          <element minOccurs="0" maxOccurs="1" name="contact" type="tns:Contact" />
         </sequence>
        </complexType>
       </element>
     
      </schema>
     </wsdl:types>
     
     <!--
      ******************************************************************************
     -->
     
     <wsdl:message name="SearchContactIn">
      <part name='idUser' type='xsd:string' />
     </wsdl:message>
     <wsdl:message name="SearchContactOut">
      <wsdl:part name="parameters" element="tns:SearchContactResponse" />
     </wsdl:message>
     
     <wsdl:message name="UpdateContactIn">
      <part name='idUser' type='xsd:string' />
      <part name='contact' type='tns:Contact' />
     </wsdl:message>
     <wsdl:message name="UpdateContactOut">
      <wsdl:part name="parameters" element="tns:UpdateContactResponse" />
     </wsdl:message>
     
     <!--
      ******************************************************************************
     -->
     
     <wsdl:portType name="PlopService">
      <wsdl:operation name="SearchContact">
       <wsdl:input message="tns:SearchContactIn" />
       <wsdl:output message="tns:SearchContactOut" />
      </wsdl:operation>
     
      <wsdl:operation name="UpdateContact">
       <wsdl:input message="tns:UpdateContactIn" />
       <wsdl:output message="tns:UpdateContactOut" />
      </wsdl:operation>
     </wsdl:portType>
     
     <!--
      ******************************************************************************
     -->
     
     <wsdl:binding name="PlopServiceSOAPBinding" type="tns:PlopService">
      <wsdlsoap:binding style="document"
       transport="http://schemas.xmlsoap.org/soap/http" />
     
      <wsdl:operation name="SearchContact">
       <wsdlsoap:operation soapAction="http://plopInc/Plopservice/SearchContact"
        style="document" />
       <wsdl:input>
        <wsdlsoap:body use="literal" namespace="http://plopInc/Plopservice" />
       </wsdl:input>
       <wsdl:output>
        <wsdlsoap:body use="literal" namespace="http://plopInc/Plopservice" />
       </wsdl:output>
      </wsdl:operation>
     
      <wsdl:operation name="UpdateContact">
       <wsdlsoap:operation soapAction="http://plopInc/Plopservice/UpdateContact"
        style="document" />
       <wsdl:input>
        <wsdlsoap:body use="literal" namespace="http://plopInc/Plopservice" />
       </wsdl:input>
       <wsdl:output>
        <wsdlsoap:body use="literal" namespace="http://plopInc/Plopservice" />
       </wsdl:output>
      </wsdl:operation>
     
     </wsdl:binding>
     
     <wsdl:service name="PlopServiceService">
      <wsdl:port name="PlopService" binding="tns:PlopServiceSOAPBinding">
       <wsdlsoap:address location="http://127.0.0.1/PlopService/PlopService.php" />
      </wsdl:port>
     </wsdl:service>
     
    </wsdl:definitions>

  4. #4
    Join Date
    Nov 2008
    Posts
    1,192

    Re: Calling a function from a client Web Service

    Well unfortunately I am like you, very new to the area. I just had to use in some time without problem.

    As I can not at all find out where the problem might occur from, I advise you, if you have not already, test your Web service with Webservice Studio tool.

    .NET Webservice Studio is a tool to invoke webmethods interactively. You can provide a WSDL endpoint. On clicking button Get the tool fetches the WSDL, generates .NET proxy from the WSDL and displays the list of methods available. You can then choose any method and provide the required input parameters. On clicking Invoke the SOAP request is sent to the server and the response is parsed to display the return value.

    In other words, this tool is meant for webservice implementers to test their webservices without having to write the client code. This could also be used to access other webservices whose WSDL endpoint is known.


    If it behaves as you wish, in this case is that it comes from the PHP code in which case I invite you to post your real PHP code.

Similar Threads

  1. IIS URL Rewrite and Silverlight calling the https WCF service
    By fanish-war in forum Technology & Internet
    Replies: 5
    Last Post: 21-06-2011, 11:21 AM
  2. Calling a JavaScript function from Flash
    By Allison in forum Software Development
    Replies: 5
    Last Post: 08-02-2011, 04:58 PM
  3. Problem when calling a Javascript function
    By Truster in forum Software Development
    Replies: 5
    Last Post: 21-07-2010, 11:37 PM
  4. calling wcf service from silverlight
    By Avanindra in forum Software Development
    Replies: 2
    Last Post: 06-07-2009, 10:16 PM
  5. Calling a function with arguments or parameter in Powershell?
    By ArunJ in forum Software Development
    Replies: 4
    Last Post: 18-02-2009, 05:53 PM

Tags for this Thread

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
  •  
Page generated in 1,713,878,331.02784 seconds with 17 queries