Error With WSDL Generation For JSR-181 EJB Endpoint With Hea
mjrother Nov 21, 2006 4:23 PMI am try to add headers to existing web services curently deployed as a stateless session EJB with JSR-181. The WSDL generated names the body part of the message is "parameters" instead of the supplied name. This results in a invalid WSDL that must be hand edited for it to work.
@WebService(name = "test", targetNamespace = "http://com.test", serviceName = "test") @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE) @Stateless public class SecureService { @WebMethod public void logout(@WebParam(name="logoutRequest") LogoutRequest request, @WebParam(name="SecHeader", header=true) String headerValue ){ } @WebMethod public void logout2(@WebParam(name="SecHeader2", header=true) String headerValue, @WebParam(name="test") String request){ } }
The resulting WSDL is :
<definitions name="test" targetNamespace="http://com.test" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://com.test" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <types> <schema elementFormDefault="qualified" targetNamespace="http://com.test" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://com.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <complexType name="LogoutRequest"> <sequence> <element name="customerId" nillable="true" type="string"/> </sequence> </complexType> <element name="SecHeader" type="string"/> <element name="SecHeader2" type="string"/> <element name="logoutRequest" type="tns:LogoutRequest"/> <element name="test" type="string"/> </schema> </types> <message name="test_logout2"> <part element="tns:SecHeader2" name="SecHeader2"/> <part element="tns:test" name="parameters"/> </message> <message name="test_logout2Response"/> <message name="test_logoutResponse"/> <message name="test_logout"> <part element="tns:logoutRequest" name="parameters"/> <part element="tns:SecHeader" name="SecHeader"/> </message> <portType name="test"> <operation name="logout"> <input message="tns:test_logout"/> <output message="tns:test_logoutResponse"/> </operation> <operation name="logout2"> <input message="tns:test_logout2"/> <output message="tns:test_logout2Response"/> </operation> </portType> <binding name="testBinding" type="tns:test"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="logout"> <soap:operation soapAction=""/> <input> <soap:header message="tns:test_logout" part="SecHeader" use="literal"/> <soap:body parts="logoutRequest" use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="logout2"> <soap:operation soapAction=""/> <input> <soap:header message="tns:test_logout2" part="SecHeader2" use="literal"/> <soap:body parts="test" use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="test"> <port binding="tns:testBinding" name="testPort"> <soap:address location="http://QUANDARY:8080/ipm-ejb/SecureService"/> </port> </service> </definitions>
The problem is in the message definition where the name of "parameters" is used. If I hand edit the WSDL to the following it works as planned:
<definitions name="test" targetNamespace="http://com.test" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://com.test" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <types> <schema elementFormDefault="qualified" targetNamespace="http://com.test" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://com.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <complexType name="LogoutRequest"> <sequence> <element name="customerId" nillable="true" type="string"/> </sequence> </complexType> <element name="SecHeader" type="string"/> <element name="SecHeader2" type="string"/> <element name="logoutRequest" type="tns:LogoutRequest"/> <element name="test" type="string"/> </schema> </types> <message name="test_logout2"> <part element="tns:SecHeader2" name="SecHeader2"/> <part element="tns:test" name="test"/> </message> <message name="test_logout2Response"/> <message name="test_logoutResponse"/> <message name="test_logout"> <part element="tns:logoutRequest" name="logoutRequest"/> <part element="tns:SecHeader" name="SecHeader"/> </message> <portType name="test"> <operation name="logout"> <input message="tns:test_logout"/> <output message="tns:test_logoutResponse"/> </operation> <operation name="logout2"> <input message="tns:test_logout2"/> <output message="tns:test_logout2Response"/> </operation> </portType> <binding name="testBinding" type="tns:test"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="logout"> <soap:operation soapAction=""/> <input> <soap:header message="tns:test_logout" part="SecHeader" use="literal"/> <soap:body parts="logoutRequest" use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="logout2"> <soap:operation soapAction=""/> <input> <soap:header message="tns:test_logout2" part="SecHeader2" use="literal"/> <soap:body parts="test" use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="test"> <port binding="tns:testBinding" name="testPort"> <soap:address location="http://QUANDARY:8080/ipm-ejb/SecureService"/> </port> </service> </definitions>
Am I doing something wrong or is there a work around?