SOAP Web Service Tutorials - Herong's Tutorial Examples - v5.13, by Herong Yang
NumberToWords Failed - Unexpected Parameter "c-gensym3"
This section provides a tutorial example on how to use a SOAP::Lite client to reach a Web service end point with the proxy parameter. But the test failed with an error: Unexpected parameter 'c-gensym3'.
In previous SOAP::Lite tutorials, we learned how to create a simple dummy SOAP server, create a simple SOAP client and make them work together.
Now let's try to write a SOAP::Lite client program to talk to a real Web service, NumberToWords, provided at https://www.dataaccess.com/webservicesserver/NumberConversion.wso. NumberToWords returns the word corresponding to the positive number passed as parameter.
Based on the above description I wrote my first version of NumberToWords.pl:
#- NumberToWords.pl #- Copyright (c) 2005 HerongYang.com. All Rights Reserved. # use SOAP::Lite +trace; my $client = SOAP::Lite->new(); $client->proxy( 'http://www.dataaccess.com/webservicesserver/NumberConversion.wso'); my $som = $client->NumberToWords(101); my $output = $som->result; print $output . "\n";
When executed, I got this:
herong> NumberToWords.pl SOAP::Transport::new: () SOAP::Serializer::new: () SOAP::Deserializer::new: () SOAP::Parser::new: () SOAP::Lite::new: () SOAP::Transport::HTTP::Client::new: () SOAP::Lite::call: () SOAP::Serializer::envelope: () SOAP::Serializer::envelope: NumberToWords 101 SOAP::Data::new: () SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x2eafea0) SOAP::Transport::HTTP::Client::send_receive: POST http://www.dataaccess.com/webservicesserver/NumberConversion.wso ... Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 443 Content-Type: text/xml; charset=utf-8 SOAPAction: "#NumberToWords" <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body> <NumberToWords> <c-gensym3 xsi:type="xsd:int">101</c-gensym3> </NumberToWords> </soap:Body> </soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x2ad6770) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error Cache-Control: private, max-age=0 Connection: close Server: Microsoft-IIS/8.0 Content-Length: 348 Content-Type: text/xml; charset=utf-8 Access-Control-Allow-Credentials: true Access-Control-Allow-Headers: content-type Access-Control-Allow-Methods: GET, POST Access-Control-Allow-Origin: http://www.dataaccess.com Client-Response-Num: 1 Strict-Transport-Security: max-age=31536000 Web-Service: DataFlex 18.1 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Error processing request: Unexpected parameter 'c-gensym3'</faultstring> <detail/> </soap:Fault> </soap:Body> </soap:Envelope> SOAP::Deserializer::deserialize: () SOAP::Parser::decode: () SOAP::SOM::new: () ...
Obviously, the Web service server failed with a "HTTP/1.1 500 Internal Server Error". It was actually caused by an exception in the Web service process: "Error processing request: Unexpected parameter 'c-gensym3'".
The issue is obvious. The server is expecting the parameter to be named as "ubiNum". But Perl SOAP::Lite is sending "c-gensym3". I will try to fix the issue in the next tutorial.
Table of Contents
Introduction to SOAP (Simple Object Access Protocol)
SOAP Message Transmission and Processing
SOAP MEP (Message Exchange Patterns)
PHP SOAP Extension Client Programs
PHP SOAP Extension Server Programs
PHP SOAP Web Service Example - getTemp
Perl SOAP::Lite - SOAP Server-Client Communication Module
Perl Socket Test Program for HTTP and SOAP
►Perl SOAP::Lite for NumberToWords SOAP 1.1 Web Service
►NumberToWords Failed - Unexpected Parameter "c-gensym3"
NumberToWords Failed - Invalid namespace ""
NumberToWords Worked - Setting Namespace and Parameter
Perl SOAP::Lite for SOAP 1.2 Web Services
Java Socket and HttpURLConnection for SOAP
SAAJ - SOAP with Attachments API for Java
SoapUI - SOAP Web Service Testing Tool
WS-Security - SOAP Message Security Extension
WS-Security X.509 Certificate Token
Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service
Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services
Perl SOAP::Lite 0.710 for WSDL