Two Laptop Bag*
The moose likes Web Services and the fly likes How to change WSDL schema definition to suit incoming requests? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to change WSDL schema definition to suit incoming requests?" Watch "How to change WSDL schema definition to suit incoming requests?" New topic
Author

How to change WSDL schema definition to suit incoming requests?

Sinha Paritosh
Greenhorn

Joined: Oct 09, 2008
Posts: 2
We are migrating a webservice project from WAS (Websphere Application Server) 5.1 to WAS 6.1 and are encountering problems related to SOAP requests received from a desktop tool that uses this service.

Theoretically the tool accessing our service should have taken the WSDL from us and generated the client but that has not happened(The tool is developed using C++ and sends the request which has been hard coded in it) and now changes to the tool in near future is beyond scope hence we need to do a work around to make this service work for the tool.

The WSDL and a sample soap request is pasted below. The request coming from the tool doesn't have namespace information which is conformant to the target namespace defined in the wsdl. All this worked fine for WAS 5.1 as there was no strict namespace checking but with WAS 6.1 its failing due to namespace validations.

Now, what we would like to do is to align the schema definition with what we receive in the SOAP request. We would like to make the schema validations work for the incoming requests that are in the attached format. So essentially our requirement is to enforce the namespace validations for requestHeader elements and bypass them for the others.

Can anybody please provide leads on what changes we need to do in the schema definition to suit the requests that are coming to us. ( I know this is an odd scenario but then we have to live in real world ! )

------------------------------------------------------------
WSDL
------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<wsdl efinitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://services.view.licensews.u90.abcd.com" xmlns:intf="http://services.view.licensews.u90.abcd.com" xmlns:tns2="http://framework.abcd.com/v3.0/" xmlns:tns3="http://valueobjects.license.u90785.abcd.com" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://services.view.licensews.u90.abcd.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:apachesoap="http://xml.apache.org/xml-soap" targetNamespace="http://services.view.licensews.u90.abcd.com" xmlns:impl="http://services.view.licensews.u90.abcd.com" xmlns:intf="http://services.view.licensews.u90.abcd.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<complexType name="LicenseRequestIPBean">
<complexContent>
<extension base="tns2:RequestMessage">
<sequence>
<element name="racfID" nillable="true" type="xsd:string" />
<element name="hostID" nillable="true" type="xsd:string"/>
<element maxOccurs="unbounded" name="licenseValue" nillable="true" type="tns3:LicenseValue" />
<element name="userIP" nillable="true" type="xsd:string"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element name="retrieveLicense">
<complexType>
<sequence>
<element name="inValueObject" nillable="true" type="impl:LicenseRequestIPBean"/>
</sequence>
</complexType>
</element>
<complexType name="LicenseRequestOPBean">
<complexContent>
<extension base="tns2:ResponseMessage">
<sequence>
<element maxOccurs="unbounded" name="licenseValueArray" nillable="true" type="tns3:LicenseValue"/>
<element name="securityValue" nillable="true" type="xsd:string"/>
<element name="userID" nillable="true" type="xsd:string"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element name="retrieveLicenseResponse">
<complexType>
<sequence>
<element name="retrieveLicenseReturn" nillable="true" type="impl:LicenseRequestOPBean"/>
</sequence>
</complexType>
</element>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://framework.abcd.com/v3.0/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://services.view.licensews.u90.abcd.com" xmlns:intf="http://services.view.licensews.u90.abcd.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<complexType name="RequestMessage">
<sequence>
<element name="requestHeader" nillable="true" type="tns2:RequestHeader"/>
</sequence>
</complexType>
<complexType name="RequestHeader">
<complexContent>
<extension base="tns2:CommonHeader">
<sequence>
<element name="replyToDetails" nillable="true" type="tns2:ReplyToDetails"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="CommonHeader">
<sequence>
<element name="headerVersion" nillable="true" type="xsd:string"/>
<element name="serviceFunctionalArea" nillable="true" type="xsd:string"/>
<element name="serviceInstance" nillable="true" type="xsd:string"/>
<element name="messageName" nillable="true" type="xsd:string"/>
<element name="messageVersion" nillable="true" type="xsd:string"/>
<element name="trackingID" nillable="true" type="xsd:string"/>
<element name="originationTimestamp" nillable="true" type="xsd ateTime"/>
<element name="locale" nillable="true" type="xsd:string"/>
<element name="sourceProgram" nillable="true" type="xsd:string"/>
<element name="firstCallingProgram" nillable="true" type="xsd:string"/>
<element name="traceLogRequired" nillable="true" type="xsd:string"/>
<element name="credentials" nillable="true" type="tns2:Credentials"/>
</sequence>
</complexType>
<complexType name="Credentials">
<sequence>
<element name="endUserID" nillable="true" type="xsd:string"/>
<element name="authorization" nillable="true" type="tns2:Authorization"/>
<element name="chargeID" nillable="true" type="xsd:string"/>
<element name="applicationID" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="Authorization">
<sequence>
<element name="authorizationID" nillable="true" type="xsd:string"/>
<element maxOccurs="unbounded" name="authorizationContext" nillable="true" type="tns2:AuthorizationContext"/>
</sequence>
</complexType>
<complexType name="AuthorizationContext">
<sequence>
<element name="contextType" nillable="true" type="xsd:string"/>
<element name="context" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="ReplyToDetails">
<sequence>
<element name="programName" nillable="true" type="xsd:string"/>
<element name="serviceInstance" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="ResponseMessage">
<sequence>
<element name="responseHeader" nillable="true" type="tns2:ResponseHeader"/>
</sequence>
</complexType>
<complexType name="ResponseHeader">
<complexContent>
<extension base="tns2:CommonHeader">
<sequence>
<element name="overallReturnCondition" nillable="true" type="tns2:ReturnCondition"/>
<element maxOccurs="unbounded" name="secondaryReturnCondition" nillable="true" type="tns2:ReturnCondition"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="ReturnCondition">
<sequence>
<element name="returnCode" nillable="true" type="xsd:string"/>
<element name="tier2Condition" nillable="true" type="tns2:Tier2Condition"/>
<element maxOccurs="unbounded" name="backEndServiceDetails" nillable="true" type="tns2:BackEndServiceDetails"/>
</sequence>
</complexType>
<complexType name="Tier2Condition">
<sequence>
<element name="returnStatus" nillable="true" type="xsd:string"/>
<element name="messageNumber" nillable="true" type="xsd:int"/>
<element name="namespace" nillable="true" type="xsd:string"/>
<element name="messageText" nillable="true" type="xsd:string"/>
<element name="requestLink" nillable="true" type="xsd:string"/>
<element name="responseLink" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="BackEndServiceDetails">
<sequence>
<element name="programName" nillable="true" type="xsd:string"/>
<element name="messageCode" nillable="true" type="xsd:string"/>
<element name="messageText" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://valueobjects.license.u90785.abcd.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://services.view.licensews.u90.abcd.com" xmlns:intf="http://services.view.licensews.u90.abcd.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<complexType name="LicenseValue">
<sequence>
<element name="licenseValue" nillable="true" type="xsd:string"/>
<element name="type" nillable="true" type="xsd:string"/>
<element name="securityKeyOrder" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>

<wsdl:message name="retrieveLicenseResponse">

<wsdl art element="intf:retrieveLicenseResponse" name="parameters"/>

</wsdl:message>

<wsdl:message name="retrieveLicenseRequest">

<wsdl art element="intf:retrieveLicense" name="parameters"/>

</wsdl:message>

<wsdl ortType name="LicenseRequestService">

<wsdl peration name="retrieveLicense">

<wsdl:input message="intf:retrieveLicenseRequest" name="retrieveLicenseRequest"/>

<wsdl utput message="intf:retrieveLicenseResponse" name="retrieveLicenseResponse"/>

</wsdl peration>

</wsdl ortType>

<wsdl:binding name="LicenseRequestServiceSoapBinding" type="intf:LicenseRequestService">

<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl peration name="retrieveLicense">

<wsdlsoap peration soapAction=""/>

<wsdl:input name="retrieveLicenseRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl utput name="retrieveLicenseResponse">

<wsdlsoap:body use="literal"/>

</wsdl utput>

</wsdl peration>

</wsdl:binding>

<wsdl:service name="LicenseRequestServiceService">

<wsdl ort binding="xxxxx" name="xxxxxxx">

<wsdlsoap:address location="xxxxxxx"/>

</wsdl ort>

</wsdl:service>

</wsdl efinitions>

------------------------------------------------------------
REQUEST MESSAGE
------------------------------------------------------------

<?xml version="1.0"?>
<soapenv:Envelope
xmlns:soapenv="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">
<soapenv:Body>
<retrieveLicense>
<licenseRequestIP>
<requestHeader xmlns="http://framework.abcd.com/v3.0/">
<headerVersion>3.0</headerVersion>
<serviceFunctionalArea>
EmbeddedLicenseManagement
</serviceFunctionalArea>
<serviceInstance>Local</serviceInstance>
<messageName>LicenseRequest</messageName>
<messageVersion>1.0</messageVersion>
<trackingID>
2becd309c7444b8986108b1a43ee5974
</trackingID>
<originationTimestamp>
2008-09-25T10:09:01.939Z
</originationTimestamp>
<locale>en_US</locale>
<sourceProgram>DesktopTool</sourceProgram>
<firstCallingProgram>
DesktopTool
</firstCallingProgram>
<traceLogRequired>Y</traceLogRequired>
<credentials>
<endUserID>prog123</endUserID>
</credentials>
</requestHeader>
<racfID>prog123</racfID>
<hostID>0011211211212212121121</hostID>
<licenseValue>
<licenseValue>
XXXX Tool 1.0 27-aug-2012
00163AA44554 AB0C61111111AABVVVXV
</licenseValue>
<type>COMP</type>
</licenseValue>
<licenseValue>
<licenseValue>
XXXX PPTTool 1.0 22-dec-2009
00163AA44554 AB0C61111111AABVVVXV
</licenseValue>
<type>COMP</type>
</licenseValue>
</licenseRequestIP>
</retrieveLicense>
</soapenv:Body>
</soapenv:Envelope>
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
The request coming from the tool doesn't have namespace information which is conformant to the target namespace defined in the wsdl. All this worked fine for WAS 5.1 as there was no strict namespace checking but with WAS 6.1 its failing due to namespace validations.


A better option than altering the WSDL schema would be to alter the incoming SOAP message by adding the namespace information. This can easily be implemented with a server-side handler. Handlers can be registered (1) by service, (2) by transport, or (3) globally for all services and transports.

The handler in this case would only apply to incoming messages sent from the desktop application.
Sinha Paritosh
Greenhorn

Joined: Oct 09, 2008
Posts: 2
James,

We tried to implement the Web Service handlers (JAX-RPC) for modifying the namespace of the incoming request before it reaches our service. However, in WAS 6.1 we found that the namespace validation gets triggered before the control reaches the web service handlers. So the request errors out before the handlers can actually modify the namespace.

Kindly suggest any alternative way to resolve this issue. We can't change the incoming request as stated earlier.

Thanks for your help.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Sounds like an issue. I am suprised that such a change was implemented without a way to disable it. Your best bet is to stick with WAS 5, until you figure this out. I suggest contacting the vendor to see if they implemented some mechanism to disable the namespace validation on the incoming SOAP message. As you mention, this worked fine with WAS 5.

Or, another solution would be to modify the desktop application so that it sends a 'good' SOAP message for the WAS 6 implementation.

Good luck!
 
Consider Paul's rocket mass heater.
 
subject: How to change WSDL schema definition to suit incoming requests?