Works in WebLogic 9.1, but not JBoss 4.0.3SP1
ypfamily Apr 5, 2006 3:32 PMHi,
I am deploying a simple WS that was developed totally by hand (i.e., all the DD were).
Works perfectly in WL, but doesn't work right in JBoss. I am using jboss-4.0.3SP1.
Here is the WSDL:
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://corexml.org/ws/HelloWorld" xmlns:hw="http://corexml.org/ws/HelloWorld"> <!-- logPing messages --> <wsdl:message name="logAccessRequest"/> <wsdl:message name="logAccessResponse"/> <!-- sayHello messages --> <wsdl:message name="greetRequest"> <wsdl:part name="nameOfPerson" type="xsd:string"/> </wsdl:message> <wsdl:message name="greetResponse"> <wsdl:part name="greeting" type="xsd:string"/> </wsdl:message> <!-- Abstract method definitions of the Web Service Protocols and bindings are not specified. --> <wsdl:portType name="HelloWorldPortType"> <!-- logAccess operation --> <wsdl:operation name="logAccess"> <wsdl:input name="request" message="hw:logAccessRequest"/> <wsdl:output name="response" message="hw:logAccessResponse"/> </wsdl:operation> <!-- greet operation --> <wsdl:operation name="greet"> <wsdl:input name="request" message="hw:greetRequest"/> <wsdl:output name="response" message="hw:greetResponse"/> </wsdl:operation> </wsdl:portType> <!-- Transportation protocol and WS protocol binding to abtract WS defined before. --> <wsdl:binding name="HelloWorldPortBinding" type="hw:HelloWorldPortType"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="logAccess"> <wsdlsoap:operation soapAction="logAccess"/> <wsdl:input name="request"> <wsdlsoap:body use="literal" namespace="http://corexml.org/ws/HelloWorld"/> </wsdl:input> <wsdl:output name="response"> <wsdlsoap:body use="literal" namespace="http://corexml.org/ws/HelloWorld"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="greet"> <wsdlsoap:operation soapAction="greet"/> <wsdl:input name="request"> <wsdlsoap:body use="literal" namespace="http://corexml.org/ws/HelloWorld"/> </wsdl:input> <wsdl:output name="response"> <wsdlsoap:body use="literal" namespace="http://corexml.org/ws/HelloWorld"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <!-- Define physical port location --> <wsdl:service name="HelloWorldService"> <wsdl:port name="HelloWorldPort" binding="hw:HelloWorldPortBinding"> <wsdlsoap:address location="http://localhost:8080/ws/HelloWorldWS"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
I used heavyweight jaxrpc mapping to expose operation names that are different from the actual method names in the SEI. I am using the JSE way, not EJB.
Here is the jaxrpc mapping file:
<?xml version="1.0" encoding="UTF-8" ?> <java-wsdl-mapping version="1.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:hw="http://corexml.org/ws/HelloWorld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd"> <package-mapping> <package-type>corexml.ws.impl.generated</package-type> <namespaceURI>http://corexml.org/ws/HelloWorld</namespaceURI> </package-mapping> <service-interface-mapping> <service-interface> corexml.ws.impl.generated.HelloWorldService </service-interface> <wsdl-service-name>hw:HelloWorldService</wsdl-service-name> </service-interface-mapping> <service-endpoint-interface-mapping> <service-endpoint-interface> corexml.ws.endpoint.HelloWorldEndpoint </service-endpoint-interface> <wsdl-port-type>hw:HelloWorldPortType</wsdl-port-type> <wsdl-binding>hw:HelloWorldPortBinding</wsdl-binding> <service-endpoint-method-mapping> <java-method-name>logPing</java-method-name> <!-- Note: no namespace as operation is already part of hw:HelloWorldPortType, so no namespace is needed. --> <wsdl-operation>logAccess</wsdl-operation> <wsdl-return-value-mapping> <method-return-value>void</method-return-value> <wsdl-message>hw:logAccessResponse</wsdl-message> </wsdl-return-value-mapping> </service-endpoint-method-mapping> <service-endpoint-method-mapping> <java-method-name>sayHello</java-method-name> <wsdl-operation>greet</wsdl-operation> <method-param-parts-mapping> <param-position>0</param-position> <param-type>java.lang.String</param-type> <wsdl-message-mapping> <wsdl-message>hw:greetRequest</wsdl-message> <wsdl-message-part-name>nameOfPerson</wsdl-message-part-name> <parameter-mode>IN</parameter-mode> </wsdl-message-mapping> </method-param-parts-mapping> <wsdl-return-value-mapping> <method-return-value>java.lang.String</method-return-value> <wsdl-message>hw:greetResponse</wsdl-message> </wsdl-return-value-mapping> </service-endpoint-method-mapping> </service-endpoint-interface-mapping> </java-wsdl-mapping>
Like I said, WebLogic works just fine and the clients are able to communicate with the WS properly. However, in JBoss, I get an exception with the following message:
java.rmi.RemoteException: Runtime exception; nested exception is:
unexpected element name: expected={http://corexml.org/ws/HelloWorld}logAccessResponse, actual={http://corexml.org/ws/HelloWorld}logPingResponse
at com.sun.xml.rpc.client.StreamingSender._handleRuntimeExceptionInSend(StreamingSender.java:331)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:313)
at corexml.ws.client.generated.HelloWorldPortType_Stub.logAccess(HelloWorldPortType_Stub.java:119)
at corexml.ws.client.HelloWorldWSClient.main(HelloWorldWSClient.java:28)
Caused by: unexpected element name: expected={http://corexml.org/ws/HelloWorld}logAccessResponse, actual={http://corexml.org/ws/HelloWorld}logPingResponse
at com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.internalDeserialize(LiteralObjectSerializerBase.java:196)
at com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.deserialize(LiteralObjectSerializerBase.java:124)
at corexml.ws.client.generated.HelloWorldPortType_Stub._deserialize_logAccess(HelloWorldPortType_Stub.java:184)
at corexml.ws.client.generated.HelloWorldPortType_Stub._readFirstBodyElement(HelloWorldPortType_Stub.java:157)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:228)
... 2 more
The message "logPingResponse" is what I had there originally when the name of the method in the SEI matched 100% with the name of the operation in the WSDL. Once I changed the operation name, I changed all the message names to match, i.e. logPing/logPingResponse changed to logAccess/logAccessResponse to be consistent.
When examining the SOAP output, here is what I see:
Service Request (using a client generated stubs of the updated WSDL with new names for the operations):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<Header xmlns="http://schemas.xmlsoap.org/soap/envelope/" />
<soapenv:Body>
<target:logAccess xmlns:target="http://corexml.org/ws/HelloWorld" />
</soapenv:Body>
</soapenv:Envelope>
Service Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:logPingResponse xmlns:ns1="http://corexml.org/ws/HelloWorld" />
</soapenv:Body>
</soapenv:Envelope>
Why is JBoss still saying "logPingResponse"? The request is obviously seeing the new WSDL. The WSDL wasn't manually copied from JBoss deployment, but gotten through a URL, so I am sure it's the latest version of it (as the request SOAP message indicates, i.e., uses logAccess, not logPing).
So, is this a JBoss bug or did I mess up and WebLogic is just being forgiving?
Thanks,
Yaakov.