How to get the mime data from the DataHandler
I send a soap message using MTOM by Axis2, and i monitor the soap get the message below:
--MIMEBoundaryurn_uuid_5C5747FDE5329B8CEB1280130156514
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:5C5747FDE5329B8CEB1280130156515@apache.org>
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:EventMessage xmlns:ns1="http://www.iec.ch/TC57/2008/schema/message"><ns1:Header><ns1:Verb>created</ns1:Verb><ns1:Noun>NetwordDataSet</ns1:Noun></ns1:Header><ns1:Payload><ns1:Compressed><xop:Include href="cid:1.urn:uuid:5C5747FDE5329B8CEB1280130159937@apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include" /></ns1:Compressed><ns1:format>RDF</ns1:format></ns1:Payload></ns1:EventMessage></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_5C5747FDE5329B8CEB1280130156514
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID: <1.urn:uuid:5C5747FDE5329B8CEB1280130159937@apache.org>
测试一把
1
2
3
4
5
--MIMEBoundaryurn_uuid_5C5747FDE5329B8CEB1280130156514--
In the server side i got the code using code generation tools, but the dataHandler is null. And the code like this:
public void publishEvent
(
ch.iec.www.tc57._2008.schema.message.EventMessage eventMessage
)
throws FaultMessage{
//TODO : fill this with the necessary business logic
EventMessageType emt = eventMessage.getEventMessage();
开发者_JAVA技巧
PayloadType plt = emt.getPayload();
DataHandler dataHandler = plt.getPayloadTypeChoice_type0().getCompressed();
if(dataHandler!=null){....}
}
I fixed it.
It's about my XSD
<xs:choice>
<xs:any namespace="##other" processContents="skip" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>For XML payloads</xs:documentation>
</xs:annotation>
</xs:any>
<xs:element name="Compressed" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:documentation>For compressed and/or binary, uuencoded payloads</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
When i delete the <xs:choice>
portion of the XSD, i can get the dataHandler. not supported?
精彩评论