Hello!
I'm currently running a JavaME-based application, that is supposed to
send XML messages to Servlet hosted by glassfish-v2ur1-b09d.
The message received by glassfish looks like the following:
-------- begin code -----------
<v:Envelope xmlns:i="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:d="
http://www.w3.org/2001/XMLSchema"
xmlns:c="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:v="
http://schemas.xmlsoap.org/soap/envelope/">
<v:Header/>
<v:Body>
<n0:messageBody id="o0" c:root="1" xmlns:n0="
http://oben:8080/middleware/getSetData">
<standard i:type="n0:messageIdentifier">
<clientID i:type="d:string">schilling</clientID>
<clientTime i:type="d:long">1203423311921</clientTime>
<messageID i:type="d:long">0</messageID>
</standard>
<getSetData i:type="n0:getSetData">
<hello i:type="d:string">stefan</hello>
</getSetData>
</n0:messageBody>
</v:Body>
</v:Envelope>
-------- end code -----------
But glassfish doesn't find the BODY part of this message. On the other
hand, it CAN read the following message created with glassfish's
javaee-libs:
-------- begin code -----------
<SOAP-ENV:Envelope_xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ServerRequest:command xmlns:ServerRequest="sendInquiry">
<Inquiry>
<clientID>2</clientID>
<businessEmployeeID>0</businessEmployeeID>
<startDate>1203374351511</startDate>
<endDate>1203460740000</endDate>
<vehicleDesc>
<categoryNr>3</categoryNr>
<categoryDesc>big</categoryDesc>
</vehicleDesc>
</Inquiry><
</ServerRequest:command>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-------- end code -----------
Here's the command I'm using to unpack the message:
-------- begin code -----------
public void doPost( HttpServletRequest request, HttpServletResponse response )
throws ServletException, IOException {
logger.info("doPost");
try {
// Get all the headers from the HTTP request
MimeHeaders headers = getHeaders(request);
// Get the body of the HTTP request
InputStream is = request.getInputStream();
// Now internalize the contents of a HTTP request
// and create a SOAPMessage
SOAPMessage incomingMessage = messageFactory.createMessage(headers, is);
/* Retrieve envelope contents from message received */
SOAPBody sentSB = incomingMessage.getSOAPBody();
Iterator sentIt = sentSB.getChildElements();
SOAPBodyElement soapBodyE = (SOAPBodyElement) sentIt.next();
[..]
} catch ...
}
-------- end code -----------
soapBodyE stays empty, just as any other getChildElements() return
value.
On the client side, the message is created as follows (just some parts
of it here...):
-------- begin code -----------
SoapObject outgoingSoapObject = prepareSoapObject("messageBody");
SoapObject standardSoapObject = prepareSoapObject("standard");
standardSoapObject.addProperty("clientId", "schilling");
outgoingSoapObject.addProperty("messageIdentifier", standardSoapObject);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = outgoingSoapObject;
HttpTransport httpTransport = new
HttpTransport("
http://oben:8080/middleware/servlets");
httpTransport.call(methodName, envelope);
-------- end code -----------
I already tried it with a less nested document, but glassfish still
won't find the contents.
Can you help me out?
Thanks a lot and please write, if you need any further details.
Bye!
Stefan
--
Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games!
http://games.entertainment.web.de/de/entertainment/games/free