Author |
Message
|
gilberthg |
Posted: Thu May 03, 2012 9:04 am Post subject: Error passing parameters to webservices' method, SOAP nodes |
|
|
 Novice
Joined: 01 Feb 2012 Posts: 14 Location: Costa Rica
|
Hi Gurus
I have a problem passing parameters to webservices' method, using SOAP nodes , any idea?
The situation is this:
1- WMBroker 8 . I created an aplication starting with a WSDL
The wsdl is from a site that offers webservices to do client testing for example. The service I'll use is for getting whois information about websites.
The WSDL is :
<?xml version="1.0" encoding="utf-8"?>
<definitions name="whois" targetNamespace="http://www.webservicex.net" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://www.w3.org/TR/html4/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.webservicex.net" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<documentation>
<appinfo source="WMQI_APPINFO">
<MRWSDLAppInfo imported="true">
<binding hasEncoding="false" imported="true" name="whoisSoap" originalBindingStyle="document"/>
</MRWSDLAppInfo>
</appinfo>
</documentation>
<types>
<s:schema>
<s:import namespace="http://www.webservicex.net" schemaLocation="RemoteFiles/net/webservicex/www/whois.xsd"/>
</s:schema>
</types>
<message name="GetWhoISSoapIn">
<part element="tns:GetWhoIS" name="parameters"/>
</message>
<message name="GetWhoISSoapOut">
<part element="tns:GetWhoISResponse" name="parameters"/>
</message>
<portType name="whoisSoap">
<operation name="GetWhoIS">
<input message="tns:GetWhoISSoapIn"/>
<output message="tns:GetWhoISSoapOut"/>
</operation>
</portType>
<binding name="whoisSoap" type="tns:whoisSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetWhoIS">
<soap:operation soapAction="http://www.webservicex.net/GetWhoIS" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="whois">
<port binding="tns:whoisSoap" name="whoisSoap">
<soap:address location="http://www.webservicex.net/whois.asmx"/>
</port>
</service>
</definitions>
1.5 - The additional XSD is :
<?xml version="1.0" encoding="UTF-8"?>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.webservicex.net" version="1.0" xmlns:tns="http://www.webservicex.net" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" >
<s:element name="GetWhoIS">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="HostName" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetWhoISResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetWhoISResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="string" nillable="true" type="s:string"/>
</s:schema>
2- After I created an MQ Input NODE, the output of this is going to a compute node, previous to the subflow just generated in 1.
So we have, an MQ Input node, a Compute Node , and then the subflow generated from the WSDL.
3- The example message I'm sending to the MQ Queque is ( very simple ):
<?xml version="1.0" encoding="utf-8"?>
<whois>
<localElement>
<HostName>
www.google.com
</HostName>
</localElement>
</whois>
4- The Compute node logic is ( again, very simple ):
DECLARE ns NAMESPACE 'http://www.webservicex.net/';
CREATE COMPUTE MODULE MyFlow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot.XMLNSC.ns:GetWhoIs.HostName = InputRoot.XMLNSC.whois.localElement.HostName;
RETURN TRUE;
END;
END MODULE;
4- The error I'm getting is :
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Length: 576
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 03 May 2012 16:28:45 GMT
<SOAP_Domain_Msg xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Context operation="GetWhoIS" operationType="UNKNOWN" portType="whoisSoap" portTypeNamespace="http://www.webservicex.net" port="whoisSoap" service="whois" fileName="whois.wsdl"><SOAP_Version>1.1</SOAP_Version><Namespace xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/><_XmlDeclaration Version="1.0" Encoding="utf-8"/></Context><Header/><Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentNullException: Value cannot be null.
at whois.whois.GetWhoIS(String HostName)
--- End of inner exception stack trace ---</faultstring><detail/></soap:Fault></Body></SOAP_Domain_Msg>
5- Please give me any advice, because I don't know where to search for the problem.
I developed another similar webservice, for a simple calculator java webservice, in glassfish local to my box, and it worked smooth ....
I look for the 2 wsdl and they are very similar in structure ...
thanks!
Gilberth |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 03, 2012 9:08 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If you read the fault message, you'll see that it's telling you you aren't sending the right thing in the Hostname field of the soaprequest. |
|
Back to top |
|
 |
gilberthg |
Posted: Thu May 03, 2012 9:17 am Post subject: That's the problem, the subflow generated must do it,or not? |
|
|
 Novice
Joined: 01 Feb 2012 Posts: 14 Location: Costa Rica
|
Thanks, correct
But that's the problem, the subflow generated using the WSDL has to construct the webservice's invoking, using the
"OutputRoot.XMLNSC.ns:GetWhoIs.HostName "
I'm providing it , at the Compute node , or not ?
This is the only point where I work with the parameters.
Thanks again... |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 03, 2012 9:38 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's not a question of what the compute node does or doesn't do, exactly.
It's a question of what the logical message tree before the soap request node looks like.
Take a user trace. put in a trace node. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu May 03, 2012 9:45 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Put in [c o d e ] tags also. You should have Trace nodes before and after every major node in your flow. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mgk |
Posted: Thu May 03, 2012 9:56 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Have you checked that the MQInput node is set to use the XMLNSC parser?
If you have, then I agree with mqjeff that you should put a trace node after the compute node before the SOAPRequest node and trace $Root.
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
gilberthg |
Posted: Thu May 03, 2012 12:15 pm Post subject: Thanks all : Trace result |
|
|
 Novice
Joined: 01 Feb 2012 Posts: 14 Location: Costa Rica
|
Tranks all
I already checked XMLNSC parser mgk suggests.
1- The trace result is not what I expected, it seems like there is no "body" in the message flow that is entering the soap subflow :
The trace contents are only :
<NS1:GetWhoIs xmlns:NS1="http://www.webservicex.net/"/>
2- I put a message in the queue, that I posted before :
<?xml version="1.0" encoding="utf-8"?>
<whois><localElement>
<HostName>www.google.com</HostName>
</localElement></whois>
3- And the code of the Compute node is :
DECLARE ns NAMESPACE 'http://www.webservicex.net/';
CREATE COMPUTE MODULE MyFlow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot.XMLNSC.ns:GetWhoIs.HostName = InputRoot.XMLNSC.whois.localElement.HostName;
RETURN TRUE;
END;
END MODULE;
This is a diagram of the message flow ...
[img] http://www.dactiv.com/foro/images/flow.jpg[/img] |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu May 03, 2012 12:16 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
gilberthg |
Posted: Thu May 03, 2012 2:32 pm Post subject: SOAPRequest NODE receives message ok, but fails |
|
|
 Novice
Joined: 01 Feb 2012 Posts: 14 Location: Costa Rica
|
Thanks again
1- Using trace getting to subflow, the IN node traces to :
<NS1:GetWhoIs xmlns:NS1="http://www.webservicex.net/">
<HostName>www.google.com</HostName></NS1:GetWhoIs>
That looks ok to me , but :
2- the SOAPRequest node fails with the error descirbed, but the SOAPRequest is configurated automaticly from the wsld , and the wsdl ( I posted before ) I think is ok to , so I don't know why it fails ... :
<SOAP_Domain_Msg xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Context operation="GetWhoIS" operationType="UNKNOWN" portType="whoisSoap" portTypeNamespace="http://www.webservicex.net" port="whoisSoap" service="whois" fileName="whois.wsdl"><SOAP_Version>1.1</SOAP_Version><Namespace xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/><_XmlDeclaration Version="1.0" Encoding="utf-8"/></Context><Header/><Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentNullException: Value cannot be null.
at whois.whois.GetWhoIS(String HostName)
--- End of inner exception stack trace ---</faultstring><detail/></soap:Fault></Body></SOAP_Domain_Msg>
thanks |
|
Back to top |
|
 |
|