Consuming ND7 Web Service fails with error when SOAP message format is changed to 'Doc/literal' or 'Wrapped'

I am consuming a Domino Web Service in a JSR 168 JSF portlet in Rational Application Developer 6. My portal test environment is Portal v5.1.

When I have the SOAP Message Format in the Domino Web Service design element set to ‘RPC/encoded’, the web service works like a charm. I am able to pull the required data in to my portlet successfully. However, when I change the SOAP Message Format to ‘Doc/literal’, the portlet fails to load and I get the following error on my console in RAD:

"2/14/07 19:19:42:547 EST] 6578154a enterprise I com.ibm.ws.webservices.engine.enterprise WSWS3243I: Info: Mapping Exception to WebServicesFault.

[2/14/07 19:19:42:562 EST] 6578154a enterprise I com.ibm.ws.webservices.engine.enterprise TRAS0014I: The following exception was logged WebServicesFault

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException

faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

faultActor: null

faultDetail:

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

at com.ibm.ws.webservices.engine.xmlsoap.builders.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:228)

at com.ibm.ws.webservices.engine.xmlsoap.builders.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:156)

at com.ibm.ws.webservices.engine.events.P2DConverter.endElement(P2DConverter.java:409)

at sax.SAX2DocumentEntityParserBase.endElementAction(Unknown Source)....etc. etc."

Similarly, when I change the SOAP Message Format to ‘Wrapped’, the portlet fails to load and I get the following error on my console in RAD:

"[2/14/07 19:22:31:641 EST] 6578154a Connection E com.ibm.ws.webservices.engine.client.Connection WSWS3227E: Error: Exception:

[2/14/07 19:22:31:641 EST] 6578154a Connection E com.ibm.ws.webservices.engine.client.Connection TRAS0014I: The following exception was logged org.xml.sax.SAXException: WSWS3368E: Error: The deserialization event characters for (On Schedule) was unexpected in com.ibm.ws.webservices.engine.encoding.ser.ArrayDeserializer.

at com.ibm.ws.webservices.engine.encoding.ser.ArrayDeserializer.characters(ArrayDeserializer.java:534)

at com.ibm.ws.webservices.engine.events.P2DConverter.flush(P2DConverter.java:806)

etc. etc."

In this example, the data I am trying to pull from Domino is not particularly complex; it’s just two arrays of java.lang.String() values. I’m not doing anything special with the data at this point - just writing out the values from the web service ResultBean to the console.

We had hoped to use ‘Doc/literal’ or ‘Wrapped’ for our web services since (based on the reading we’ve done), these formats would help us conform better to the preferred WS-I Basic Profile.

Can anyone shed any light on why this problem is occurring? More importantly, is there any way to get around it so that web services served up by Domino can be consumed by a portlet in ‘Doc/literal’ or ‘Wrapped’ format?

Thanks.

Subject: RESOLVED - Consuming ND7 Web Service fails with error when SOAP message format is changed to ‘Doc/literal’ or ‘Wrapped’

For anyone in the future who may experience a similar problem, here is the resolution I found.

Just importing the new ‘Wrapped’ WSDL into RAD and rebuilding the WS client did not fix the problem. The problem was the String arrays themselves.

Apparently, you should not reference arrays directly in your Java web service in Domino. This can cause your WSDL to be malformed (which was in fact the problem I experienced). Instead wrap your arrays in a wrapper class. This can be as simple as a class that has only one public attribute which is your array. (There was some mention of this issue in a devWorks document regarding arrays written in LotusScript, but no mention was made of Java. Apparently the problem exists for Java in Domino too.)

As soon as I put my arrays inside a wrapper class, my WSDL was formed correctly and my web service worked on the first attempt.