vrijdag 21 oktober 2011

Websphere failure

We had a problem with a SOAP on WebSphere. We had the same code running on glassfish, no problems.
When we deployed on websphere (7) sending the messagerequest failed with:

javax.xml.ws.soap.SOAPFaultException: The endpoint reference (EPR) for the Operation not found is http://xxx.xxx.xxx:12116/OW-WebService/InvestmentResultPeriodService and the WSA Action =
After some poking around I found out that there was a slight difference in the format of the SOAP message being sent

This was the faulty message
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ows="http://abnamro.nl/services" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<country xmlns="http://xxx">NL</country>
</soapenv:Header>
<soapenv:Body>
<ns2:invesRequestType
xmlns:ns2="http://xxx">
<currencyCode>USD</currencyCode>
<locale>en</locale>
<forceRealtime>false</forceRealtime>
</ns2:invesRequestType>
</soapenv:Body>
</soapenv:Envelope>

And this is what it actually should look like

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ows="http://abnamro.nl/services" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<country xmlns="http://xxx">NL</country>
</soapenv:Header>
<soapenv:Body>
<invesRequestType
xmlns:ns2="http://xxx">
<currencyCode>USD</currencyCode>
<locale>en</locale>
<forceRealtime>false</forceRealtime>
</invesRequestType>
</soapenv:Body>
</soapenv:Envelope>

So the only difference in the message is the ns2 in the invesResult

So why did this occur?

After comparing the InvesRequestType to another, working, class the difference was an annotation

@XmlRootElement

I used this before for exposing the class through rest

Apparently websphere does not like the outcome of adding this annotation.