Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 02-11-2009
Member
 
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?
Reply With Quote
  #2  
Old 02-11-2009
Member
 
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!
Reply With Quote
  #3  
Old 02-11-2009
Member
 
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>
Reply With Quote
  #4  
Old 02-11-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 06:16 PM.