[#JAX_WS-620] Service.Mode.MESSAGE generates incorrect SOAP

advertisement
[JAX_WS-620] Service.Mode.MESSAGE generates incorrect SOAP request
with Dispatch<JAXBContext> Created: 11/Sep/08 Updated: 21/Sep/11 Resolved: 21/Sep/11
Status:
Project:
Component/s:
Affects
Version/s:
Fix Version/s:
Resolved
jax-ws
runtime
2.1.4
Type:
Reporter:
Resolution:
Labels:
Remaining
Estimate:
Time Spent:
Original
Estimate:
Environment:
Bug
honda_m
Fixed
None
Not Specified
Attachments:
client_src.zip
620
metro2_1-waived
Issuezilla Id:
Tags:
2.2.6
Priority:
Assignee:
Votes:
Major
miroslav.kos
0
Not Specified
Not Specified
Operating System: All
Platform: All
JAX_WS-620.patch
Description
Dispatch<JAXBContext> was created in Service.Mode.MESSAGE.
I expected the following SOAP messages to be transmitted.
<ns2:Envelope xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/">
<ns2:Body>
<addNumbers:addNumbers xmlns:addNumbers="http://duke.example.org"
xmlns="http://duke.example.org"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<arg0>10</arg0>
<arg1>20</arg1>
</addNumbers:addNumbers>
</ns2:Body>
</ns2:Envelope>
But, incorrect SOAP request was transmitted.
<S:Envelope> and <S:Body> are double.(part of *)
actual SOAP request is as follows.
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">*
<S:Body>*
<S:Envelope>*
<S:Body>*
<addNumbers:addNumbers
xmlns:addNumbers="http://duke.example.org" xmlns="http://duke.example.org"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<arg0>10</arg0>
<arg1>20</arg1>
</addNumbers:addNumbers>
</S:Body>*
</S:Envelope>*
</S:Body>*
</S:Envelope>*
In JAX-WS rule 4.3 javax.xml.ws.Dispatch, there is the following description.
Message
In this mode, client applications work directly with protocol-specific
message structures.
E.g.,when used with a SOAP protocol binding, a client application would work
directly with a SOAP message.
Message Payload
In this mode, client applications work with the payload of messages rather
than the messages themselves.
E.g., when used with a SOAP protocol binding, a client application would work
with the contents of the SOAP Body rather
than the SOAP message as a whole.
JAXB Objects
JAXB objects may be used with any protocol binding in either message or
message payload mode.
In Java API for XML Web Services (JAX-WS) Dispatch, there is the following
description.
https://jax-ws.dev.java.net/nonav/2.1.3/docs/dispatch.htmlJava
Create a Dispatch<T> instance.
For a javax.xml.transform.Source and JAXB data binding java.lang.Object
Dispatch<T> can be created
in both Service.Mode.PAYLOAD and Service.Mode.MESSAGE modes.
—
I saw the source of JAX-WS version 2.1.3.
I thought that it don't checke MESSAGE or PAYLOAD.
The source that I saw is as follows.
・com.sun.xml.ws.client.dispatch.JAXBDispatch.java (98~110 line)
Packet createPacket(Object msg) {
assert jaxbcontext != null;
try
{ Marshaller marshaller = jaxbcontext.createMarshaller();
marshaller.setProperty("jaxb.fragment", Boolean.TRUE); Message message = (msg == null) ?
Messages.createEmpty (soapVersion): Messages.create(marshaller, msg, soapVersion); (go to
*1) return new Packet(message); }
catch (JAXBException e)
{ throw new WebServiceException(e); }
}
・com.sun.xml.ws.message.jaxb.JAXBMessage.java
(114~140 line)
public static Message create(JAXBRIContext context, Object jaxbObject,
SOAPVersion soapVersion) { (*1)
if(!context.hasSwaRef())
{ return new JAXBMessage(context,jaxbObject,soapVersion); (go to *2) }
(Omission)
}
(142~147 line)
private JAXBMessage( JAXBRIContext context, Object jaxbObject, SOAPVersion
soapVer )
{ (*2) super(soapVer); (go to *3) this.bridge = new MarshallerBridge(context); this.jaxbObject
= jaxbObject; this.attachmentSet = new AttachmentSetImpl(); }
・com.sun.xml.ws.message.AbstractMessageImpl.java (92~94 line)
protected AbstractMessageImpl(SOAPVersion soapVersion)
{ (*3) this.soapVersion = soapVersion; }
Comments
Comment by honda_m [ 11/Sep/08 ]
Created an attachment (id=209)
test source
Comment by honda_m [ 11/Sep/08 ]
The source of the test is appended.
https://jax-ws.dev.java.net/nonav/issues/showattachment.cgi/209/client_src.zip
Comment by jitu [ 12/Sep/08 ]
assigning it to myself
Comment by honda_m [ 16/Sep/08 ]
The version is corrected to 2.1.4.
Comment by honda_m [ 01/Mar/09 ]
adding hosamu to cc
Comment by jitu [ 02/Nov/09 ]
Will need to create a new Message impl(instead of JAXBMessage). Will target for
2.2.1
Comment by miroslav.kos [ 20/Sep/11 ]
Attaching patch since it is impossible to sumbit it to barrida - Review Board doesn't accept diffs
containing new (added) files
Generated at Wed Feb 10 07:09:42 UTC 2016 using JIRA 6.2.3#6260sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.
Download