473,394 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

problem client soap(php) with server gsoap (c)

Hi community,
I have a problem with a Soap client written in php.
I have a local server (coded in c and a client in c too, it works fine), but i want to test client in php, and i have an error (I'm not sure to understand it...) :

Expand|Select|Wrap|Line Numbers
  1. SoapFault exception: [SOAP-ENV:Client] Method 'ns1:getMetadataRequest' not implemented: method name or namespace not recognized in beta_2/soap.php:26
  2. Stack trace:
  3. #0 /root/src/rxtxws/beta_2/soap.php(26): SoapClient->__soapCall('getMetadata', Array)
  4. #1 {main}
And when I run the server, I have this:
Expand|Select|Wrap|Line Numbers
  1. Socket connection successful: master socket = 3
  2. SOAP 1.1 fault: SOAP-ENV:Client [no subcode]
  3. "Method 'ns1:getMetadataRequest' not implemented: method name or namespace not recognized"
  4. Detail: [no detail]
  5.  
My wsdl file seems well:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- partie 1 : Definitions -->
  3. <wsdl:definitions
  4.     targetNamespace="http://192.168.0.16:8080"
  5.     xmlns:typens="http://192.168.0.16:8080"
  6.     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  7.     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  8.     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  9.     xmlns="http://schemas.xmlsoap.org/wsdl/">
  10.  
  11. <!-- partie 2 : Types-->
  12.     <wsdl:types>
  13.       <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://192.168.0.16:8080">
  14.          <xsd:element name="getMetadataRequest">
  15.             <xsd:complexType>
  16.                <xsd:sequence>
  17.                   <xsd:element name="oldname" type="xsd:string" />
  18.                   <xsd:element name="newname" type="xsd:string" />
  19.                </xsd:sequence>
  20.             </xsd:complexType>
  21.          </xsd:element>
  22.  
  23.          <xsd:element name="getMetadataResponse">
  24.             <xsd:complexType>
  25.                <xsd:sequence>
  26.                   <xsd:element name="answer" type="xsd:string"/>
  27.                </xsd:sequence>
  28.             </xsd:complexType>
  29.          </xsd:element>
  30.         </xsd:schema>
  31.     </wsdl:types>
  32.  
  33.         <!-- partie 3 : Message -->
  34.     <wsdl:message name="getMetadataRequestMessage">
  35.         <wsdl:part name="input" element="typens:getMetadataRequest"/>
  36.     </wsdl:message>
  37.     <wsdl:message name="getMetadataResponseMessage">
  38.         <wsdl:part name="output" element="typens:getMetadataResponse"/>
  39.     </wsdl:message>
  40.  
  41.  
  42.         <!-- partie 4 : Port Type -->
  43.     <wsdl:portType name="WebServicesPortType">
  44.                 <!-- partie 5 : Operation -->
  45.         <wsdl:operation name="getMetadata">
  46.             <wsdl:input message="typens:getMetadataRequestMessage"/>
  47.             <wsdl:output message="typens:getMetadataResponseMessage"/>
  48.         </wsdl:operation>
  49.     </wsdl:portType>
  50.  
  51.         <!-- partie 6 : Binding -->
  52.     <binding name="WebServicesBinding" type="typens:WebServicesPortType">
  53.         <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
  54.         <wsdl:operation name="getMetadata">
  55.             <soap:operation soapAction="getMetadata"/>
  56.             <wsdl:input><soap:body use="literal"/></wsdl:input>
  57.             <wsdl:output><soap:body use="literal"/></wsdl:output>
  58.         </wsdl:operation>
  59.     </binding>
  60.  
  61.         <!-- partie 7 : Service -->
  62.     <wsdl:service name="WebServices">
  63.                 <!-- partie 8 : Port -->
  64.         <wsdl:port name="WebServicesPort" binding="typens:WebServicesBinding">
  65.             <soap:address location="http://192.168.0.16:8080"/>
  66.         </wsdl:port>
  67. </wsdl:service>
  68. </wsdl:definitions>
  69.  
So I think my problem is in client.php, but, i don't find it:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once 'SOAP/Client.php';
  3. ini_set("soap.wsdl_cache_enabled", FALSE);
  4. $wsdl_file =  'file.wsdl';
  5.  
  6. class getMetadataRequest
  7. {
  8.    public $oldname;
  9.    public $newname;
  10.    public function __construct( $oldname, $newname )
  11.    {
  12.       $this->oldname = $oldname;
  13.       $this->newname = $newname;
  14.    }
  15.  
  16. }
  17.  
  18. try {
  19.    $classmap = array('getMetadataRequest' => 'oldname', 'getMetadataRequest' => 'newname');
  20.    $soapClient = new SoapClient($wsdl_file, array('classmap' => $classmap, 'exception' => true, 'trace' => true));
  21.  
  22.       $oldname = "oldname";
  23.       $newname = "newname";
  24.  
  25.       $getMetadataRequest = new getMetadataRequest($oldname, $newname );
  26.       $getMetadataResponse = $soapClient->__soapCall(getMetadata, array($getMetadataRequest));
  27.       /* $getMetadataResponse = $soapClient->getMetadata($getMetadataRequest); */
  28.       $result = $getMetadataResponse->answer;
  29.       echo $result;
  30.    }
  31. catch (SoapFault $fault)
  32. {
  33.    echo $fault."\n";
  34. }
  35.  
  36. ?>
  37.  
A test with nc show me some informations are received, but...
Expand|Select|Wrap|Line Numbers
  1. $nc -l -p 8080
  2. POST / HTTP/1.1
  3. Host: 192.168.0.16:8080
  4. Connection: Keep-Alive
  5. User-Agent: PHP-SOAP/5.2.0-8+etch11
  6. Content-Type: text/xml; charset=utf-8
  7. SOAPAction: "getMetadata"
  8. Content-Length: 307
  9.  
  10. <?xml version="1.0" encoding="UTF-8"?>
  11. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://192.168.0.16:8080"><SOAP-ENV:Body><ns1:getMetadataRequest><oldname>oldname</oldname><newname>newname</newname></ns1:getMetadataRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
  12.  

If you have any ideas, suggestions, I'll take it
Thanks in advance

--regards
Greg
Jul 29 '08 #1
4 11944
arg, shame on me.

Don't forget to check nsmap file. If ip/host aren't consistent, it can't work....

Sorry for that.

--
regards
Greg
Jul 29 '08 #2
good day, i have problem too, but the error is "method not implemented or namespace not recognized".. does this have something to do with nsmap? by the way what is nsmap? can you detail me the solution? thanks..
Mar 25 '10 #3
Dormilich
8,658 Expert Mod 8TB
I’m not doing much SOAP, but the nsmap refers to (I think) to the namespace mapping (one of the features of XML), if both parties (sender/receiver) don’t use the same namespaces, the XML just won’t match.
Mar 25 '10 #4
oks, thanks to all.. i got now what im looking for, gcharbon helped a lot
Mar 30 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: snowdrop | last post by:
Hi folks, try the SOAP library written in C. Using csoap you can also implement a SOAP server in C. This library depends on libxml2. Homepage: http://csoap.sourceforge.net Example client...
6
by: Ken Allen | last post by:
I am relatively new to .Net and C#, but I hav ebeen programing in other languages and done some COM work for a number of years. I am attempting to understand how to map an older program...
3
by: Salina | last post by:
I am new in C#.Net and going to write a window client/server application. my database is mysql and the data will update every min. what i need to do is push the up-to-date data to clients from...
1
by: Alexandre (www.pointnetsolutions.com) | last post by:
I am looking at building a distributed system, and i have been looking at many different options, in some cases i was thinking of a client server relation where a client would send a string to...
0
by: Julio Delgado | last post by:
Hi: I am new to try to programm an application accesing a SOAP Server. The only information I have about the server is the http://servername/rfid and that it is running on port 50002 . How can...
6
by: Pieter Coucke | last post by:
Hi, Which technology's are used to make Windows Forms (Fat) Client - Server application with VB.NET (2.0)? - XML Webservices, Remoting, DCOM, ... are there others? - Which are used the most and...
0
by: johnmiloo | last post by:
Can some one get me started with a working SOAP server that works over https. (SSL)? I have M2Crypto installed and found the following sample, but something is wrong in ssl_context =...
1
by: gezerpunta | last post by:
Hi I have to find a soap client to be able to connet to java apache soap server.And I must send a file and envelope xml.I found nusoap but I can t achieve to communicate it. Does anybody knows...
4
by: shreedhan | last post by:
hi i am trying to write a simple client server chat program. the code of server program is: #define PORT 9999 int main() { struct sockaddr_in server_addr,client_addr;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.