srikanthradix
asked on
Problem during calling a webservice
I have attached the snippet of the wsdl2java task that i am using to generate client for the webservice from wsdl. Recently they have changed the wsdl. I am getting the following error.
5/13/08 10:29:23:841 EDT] 00000030 UserException E WSWS3228E: Error: Exception: WebServicesFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultString: org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element name of bean
com.****.Employer.
Child element name does not belong in namespace .
Most likely, a third party web services platform has sent an incorrect SOAP message. Message being parsed:
faultActor: null
Checked it using Debug feature : (In our side i have checked the Employer class file it has name field in it and it is a string and it is getting populated). As soon as i call the webservice it is going to exception.
Which side is the error likely present? i mean the service side or the client side?
Please give me some suggestions on this one.
5/13/08 10:29:23:841 EDT] 00000030 UserException E WSWS3228E: Error: Exception: WebServicesFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultString: org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element name of bean
com.****.Employer.
Child element name does not belong in namespace .
Most likely, a third party web services platform has sent an incorrect SOAP message. Message being parsed:
faultActor: null
Checked it using Debug feature : (In our side i have checked the Employer class file it has name field in it and it is a string and it is getting populated). As soon as i call the webservice it is going to exception.
Which side is the error likely present? i mean the service side or the client side?
Please give me some suggestions on this one.
<target name="wsdl_java" depends="environmentConfig" description="Generating WSDL Jar">
<taskdef name="wsdl2java" classname="com.ibm.websphere.ant.tasks.WSDL2Java">
<classpath>
<path refid="classpath" />
</classpath>
</taskdef>
<wsdl2java all="true" role = "client" container = "web" url="${cc.tzix.resources.dir}/service.wsdl"
output="${temp.dir}/Client" verbose="false">
</wsdl2java>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The Employer has a name field in it. Using Debug, I noticed that Employer's name field is getting populated before calling the webservice. I am looking for possible mismatches and looking into the link you just sent. Thanks for trying to help.
ASKER
The only change that i have noticed in the old and the new wsdl is
Common for both:
<wsdl:definitions targetNamespace="http://sample.com" xmlns:impl="http://sample.com" xmlns:intf="http://sample.com" xmlns:tns2="http://v0.sample.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Old wsdl:
<wsdl:message name="rException">
<wsdl:part element="impl:rException" name="fault"/>
</wsdl:message>
<wsdl:message name="rcResponse">
<wsdl:part element="impl:rcResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="rcsResponse">
<wsdl:part element="impl:rcsResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="rcRequest">
<wsdl:part element="impl:rc" name="parameters"/>
</wsdl:message>
<wsdl:message name="rcsRequest">
<wsdl:part element="impl:rcs" name="parameters"/>
</wsdl:message>
<wsdl:portType name="cWebService">
<wsdl:operation name="rc">
<wsdl:input message="impl:rcRequest" name="rcRequest"/>
<wsdl:output message="impl:rcResponse" name="rcResponse"/>
<wsdl:fault message="impl:rException" name="rException"/>
</wsdl:operation>
<wsdl:operation name="rcs">
<wsdl:input message="impl:rcsRequest" name="rcsRequest"/>
<wsdl:output message="impl:rcsResponse" name="rcsResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="cWebServiceSoapBindi ng" type="impl:cWebService">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="rc">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="rcRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="rcResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="rException">
<wsdlsoap:fault name="rException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="rcs">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="rcsRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="rcsResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="cWebServiceService">
<wsdl:port binding="impl:cWebServiceS oapBinding " name="cWebService">
<wsdlsoap:address location="http://url_of_the_host"/>
</wsdl:port>
</wsdl:service>
New wsdl:
"Instead of impl replace it with intf "
for example:
<wsdl:port binding="intf:cWebServiceS oapBinding "
from the above wsdl.
Does it make any difference to use impl or intf they have same namespace.?
Common for both:
<wsdl:definitions targetNamespace="http://sample.com" xmlns:impl="http://sample.com" xmlns:intf="http://sample.com" xmlns:tns2="http://v0.sample.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Old wsdl:
<wsdl:message name="rException">
<wsdl:part element="impl:rException" name="fault"/>
</wsdl:message>
<wsdl:message name="rcResponse">
<wsdl:part element="impl:rcResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="rcsResponse">
<wsdl:part element="impl:rcsResponse"
</wsdl:message>
<wsdl:message name="rcRequest">
<wsdl:part element="impl:rc" name="parameters"/>
</wsdl:message>
<wsdl:message name="rcsRequest">
<wsdl:part element="impl:rcs" name="parameters"/>
</wsdl:message>
<wsdl:portType name="cWebService">
<wsdl:operation name="rc">
<wsdl:input message="impl:rcRequest" name="rcRequest"/>
<wsdl:output message="impl:rcResponse" name="rcResponse"/>
<wsdl:fault message="impl:rException" name="rException"/>
</wsdl:operation>
<wsdl:operation name="rcs">
<wsdl:input message="impl:rcsRequest" name="rcsRequest"/>
<wsdl:output message="impl:rcsResponse"
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="cWebServiceSoapBindi
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="rc">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="rcRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="rcResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="rException">
<wsdlsoap:fault name="rException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="rcs">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="rcsRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="rcsResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="cWebServiceService">
<wsdl:port binding="impl:cWebServiceS
<wsdlsoap:address location="http://url_of_the_host"/>
</wsdl:port>
</wsdl:service>
New wsdl:
"Instead of impl replace it with intf "
for example:
<wsdl:port binding="intf:cWebServiceS
from the above wsdl.
Does it make any difference to use impl or intf they have same namespace.?
Did you create stub classes using the WSDL2ava on the New WSDL or Old WSDL? infact the if you have only changed the Prefix i.e impl to intf it must not matter, any way to test it from the common portion of the WSDL remove
xmlns:impl="http://sample.com"
so that it looks like this
<wsdl:definitions targetNamespace="http://sample.com" xmlns:intf="http://sample.com" xmlns:tns2="http://v0.sample.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
and open it in RAD(WSDL / XML editor) to see if there are any errors shown which tell u if there are any references missed out.
xmlns:impl="http://sample.com"
so that it looks like this
<wsdl:definitions targetNamespace="http://sample.com" xmlns:intf="http://sample.com" xmlns:tns2="http://v0.sample.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
and open it in RAD(WSDL / XML editor) to see if there are any errors shown which tell u if there are any references missed out.
Try regenerating the client with the new WSDL before that clear all the classes which were generated previously.
ASKER
Can you please take a look at these files and tell me what is the problem if any?
wsdl-Old.txt
wsdl-new.txt
wsdl-Old.txt
wsdl-new.txt
Lots of confusion with the namespace used in the WSDL here more than prefix or any thing the importing of name space is causing the confusion, out of curiosity I just want to know why you want to change the name space prefix, because here the prefix is not uniquely identifying an element infact the same prefix has been used in multiple scopes.
ASKER
I don't know. It is the other team that has changed this wsdl and we are calling their service and using their service. Thanks for pointing it out though. I shall look into this issue with their team tomorrow and shall see what happens if i try to run the wsdl2java using the same namespace prefix at all times.
I have changed it try using this WSDL, the other team has forgot to remove the complete impl prefix in the first part of the new WSDL this is hard to make out until you delete the namespaces and check in editor :)
wsdl-new.txt
wsdl-new.txt
ASKER
Still the same:
I ran the ant build and tested it again using the new wsdl that you have sent me.
org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element name.
I think since it is the de-serialization problem. It can also be thought of as something on the other side (server side) they might be using the wsdl that doesn't have name element in Employer. Might i be right?
I ran the ant build and tested it again using the new wsdl that you have sent me.
org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element name.
I think since it is the de-serialization problem. It can also be thought of as something on the other side (server side) they might be using the wsdl that doesn't have name element in Employer. Might i be right?
ASKER
This new wsdl is also working when
I change the <wsdlsoap:address location="development_envi ronment"/>
But now working if i change it to <wsdlsoap:address location="integration_envi ronment"/>
Giving the above error when i use the integration environment.
I change the <wsdlsoap:address location="development_envi
But now working if i change it to <wsdlsoap:address location="integration_envi
Giving the above error when i use the integration environment.
>>I think since it is the de-serialization problem. It can also be thought of as something on the other side (server side) they might be using the wsdl that doesn't have name element in Employer. Might i be right?
The reason why this changw was compatible was the fact that both intf and impl were haveing same uri .
so that wil not cause a problem.
>>But not working if i change it to <wsdlsoap:address location="integration_envi
how different in the integration env ?
hmm ok here is one simple suggestion, do you know the actual service WSDL URL? if yes use that for generating the client and use it, it really doesn't matter which prefix you are using in the WSDL which u will use for generating client, what matter is is the server able to see the message elements under appropriate namespace and scopes.
ASKER
It didn't work even though i copied the actual service wsdl url http://*.wsdl for generating the client and used it just now. Still getting the same error.
org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element name
It is absolutely unfathomable for me who has just started to use WebServices to see that the same wsdl works perfectly fine for one host and im-perfectly errored for another host
org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element name
It is absolutely unfathomable for me who has just started to use WebServices to see that the same wsdl works perfectly fine for one host and im-perfectly errored for another host
Then definetly its a configuration environment issue, please check the pdf I had previously mentioned.
ASKER
It's not solved yet. But you deserve a cookie for sparing your time. Thanks a lot. Hopefully the problem is present in the pdf file i believe.
ASKER
I have opened another question which shows the SOAP request and response that i am sending to the host. Please take a look at it. I have traced it with the help of tcpmon.
https://www.experts-exchange.com/questions/23409196/GETTING-A-SOAP-EXCEPTION-WHEN-CALLING-A-WEBSERVICE.html
https://www.experts-exchange.com/questions/23409196/GETTING-A-SOAP-EXCEPTION-WHEN-CALLING-A-WEBSERVICE.html
check this http://www-1.ibm.com/support/docview.wss?uid=swg21286259