You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Francisco Fernandez Velasco <ff...@nayadegroup.com> on 2006/08/01 13:25:41 UTC

RE: SwA Axis2 implementation swaRef document literal

Robert and Anne, thanks for the documentation. It´s really good. I´m doing
exactly the same that you say, but I have the same result with the
SOAPMonitor:

<?xml version="1.0" encoding="utf-8"?>
 <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <soapenv:Header/>
         <soapenv:Body>
                 <enqueue-image>
                         <meta-info>foo</meta-info>
 <image-ttachment>//zU8Guvrtr7aXm14hR7GyI42QkWK+KgyEQRY0yI9wyI9rBgt4URERERER
ERHyutByKM1IzUrqgEECBdCyBxqAg4ROyGeTHUtw2U5Yk+9PQ5QY/LGGHevw3/t6Jjv7f+303kGA
P/IMdb0ryY//9vSfQ/8sZb9v/17ehf0v9vT5BrCX+xomjsjhwTy4ICKeXVlwlkcUj6ulePiCQi44
i96blvCEq5lQZ0zPZnuHpqIiIiIiIiP//5bqp097om4egwyku2vbXt8Em0qsNLhtLtpdtLTa9tLt
hLsQuyMf0....../k4krqa//0g==</image-attachment>
                </enqueue-image>
         </soapenv:Body>
 </soapenv:Envelope>

I think this is not the correct way for sending an image via MTOM ok?

Here is the WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://foo.com/types/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://foo.com/types/">
	<types>
		<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
elementFormDefault="qualified" targetNamespace="http://foo.com/types/">
			<xsd:import
namespace="http://www.w3.org/2005/05/xmlmime"
schemaLocation="http://www.w3.org/2005/05/xmlmime"/>
			<xsd:element name="image-attachment"
xmime:expectedContentTypes='image/tiff,image/jpg'>
				<xsd:complexType>
					<xsd:simpleContent>
						<xsd:extension
base="xsd:base64Binary">
							<xsd:attribute
ref="xmime:contentType" use="required"/>
						</xsd:extension>
					</xsd:simpleContent>
				</xsd:complexType>
			</xsd:element>
			<xsd:element name="emptyResponse">
				<xsd:complexType/>
			</xsd:element>
			<xsd:element name="enqueue-image">
				<xsd:complexType>
					<xsd:sequence>
						<xsd:element
name="meta-info" type="xsd:string"/>
						<xsd:element
ref="tns:image-attachment" minOccurs="1" maxOccurs="1" />
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
		</xsd:schema>
	</types>
	<message name="enqueueImageRequest">
		<part name="image" element="tns:enqueue-image"/>
	</message>
	<message name="emptyResponse"/>
	<portType name="XXXPortType">
		<operation name="enqueue_image">
			<input name="image"
message="tns:enqueueImageRequest"/>
			<output name="empty" message="tns:emptyResponse"/>
		</operation>
	</portType>
	<binding name="XXXSoapBinding" type="tns:XXXPortType">
		<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
		<operation name="enqueue_image">
			<soap:operation
soapAction="http://foo.com/XXX/enqueueImage"/>
			<input>
				<soap:body use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>
	</binding>
	<service name="XXXServiceMTOM">
		<port name="XXXPortType" binding="tns:XXXSoapBinding">
			<soap:address location="http://"/>
		</port>
	</service>
</definitions>

So, as Davanum Srinivas said, maybe I have to open a JIRA bug report.

Thanks.


-----Mensaje original-----
De: Anne Thomas Manes [mailto:atmanes@gmail.com] 
Enviado el: lunes, 31 de julio de 2006 21:31
Para: axis-dev@ws.apache.org
Asunto: Re: SwA Axis2 implementation swaRef document literal

Dims suggests you have a look at this:

http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/xdocs/latest/mt
om-guide.html


On 7/31/06, Francisco Fernandez Velasco <ff...@nayadegroup.com> wrote:
> Thanks Anne,
>
> Now, I think I have the WSDL in the correct way:
>
> <xsd:element name="enqueue-image">
> <xsd:complexType>
>         <xsd:sequence>
>                 <xsd:element name="meta-info" type="xsd:string"/>
>                         <xsd:element name="image-attachment">
>                         <xsd:complexType>
>                         <xsd:simpleContent>
>                           <xsd:extension base="xsd:base64Binary" >
>                                     <xsd:attribute ref="xmime:contentType"
> use="required"/>
>                           </xsd:extension>
>                         </xsd:simpleContent>
>                         </xsd:complexType>
>                 </xsd:element>
>         </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
>
> Also I have the axis2.xml with MTOM activated:
> <parameter name="enableMTOM" locked="false">true</parameter>
>
> And I guess I´m using the generated Stub in the correct way:
> image.setMetaInfo( "foo");
> EnqueueImage.ImageAttachment imageAttachment =
> EnqueueImage.ImageAttachment.Factory.newInstance();
> imageAttachment.setByteArrayValue( data );
> image.setImageAttachment( imageAttachment );
> imageDoc.setEnqueueImage( image );
> stub.enqueue_image( imageDoc );
>
> But with the SOAPMonitor, I see the next message being transmitted:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>         <soapenv:Header/>
>         <soapenv:Body>
>                 <enqueue-image>
>                         <meta-info>foo</meta-info>
>
>
<image-attachment>//zU8Guvrtr7aXm14hR7GyI42QkWK+KgyEQRY0yI9wyI9rBgt4URERERER
>
ERHyutByKM1IzUrqgEECBdCyBxqAg4ROyGeTHUtw2U5Yk+9PQ5QY/LGGHevw3/t6Jjv7f+303kGA
>
P/IMdb0ryY//9vSfQ/8sZb9v/17ehf0v9vT5BrCX+xomjsjhwTy4ICKeXVlwlkcUj6ulePiCQi44
>
i96blvCEq5lQZ0zPZnuHpqIiIiIiIiP//5bqp097om4egwyku2vbXt8Em0qsNLhtLtpdtLTa9tLt
> hLsQuyMf0....../k4krqa//0g==</image-attachment>
>                 </enqueue-image>
>         </soapenv:Body>
> </soapenv:Envelope>
>
>
> So I guess I am not using MTOM in the correct way because the image is
being
> sent base64 encoded and I guess that should be sent in mime type!!!
>
> Any suggestion???
>
> Thanks in advanced
>
> -----Mensaje original-----
> De: Anne Thomas Manes [mailto:atmanes@gmail.com]
> Enviado el: viernes, 28 de julio de 2006 18:59
> Para: axis-dev@ws.apache.org
> Asunto: Re: SwA Axis2 implementation swaRef document literal
>
> When using MTOM, you define your binary content as xsd:base64binary
> within your message element. At serialization time, MTOM automatically
> extracts the binary data and attaches it in a separate MIME part. If
> you want to predefine the type of binary content, then you can use the
> xmime types defined in the "Assigning Media Types to Binary Data in
> XML" specification [1]. Here's the example from the spec:
>
> <?xml version="1.0" ?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            xmlns:tns="http://example.com/ct-required"
>            xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
>            targetNamespace="http://example.com/ct-required">
>
>     <xs:import namespace="http://www.w3.org/2005/05/xmlmime"
>                 schemaLocation="http://www.w3.org/2005/05/xmlmime"/>
>
>     <!-- This element has binary content and requires the
xmime:contentType
>          attribute that indicates the content-type of the binary element
-->
>     <xs:element name="MyBinaryData">
>       <xs:complexType>
>         <xs:simpleContent>
>           <xs:extension base="xs:base64Binary" >
>             <xs:attribute ref="xmime:contentType" use="required"/>
>           </xs:extension>
>         </xs:simpleContent>
>       </xs:complexType>
>     </xs:element>
>
> </xs:schema>
>
> [1] http://www.w3.org/TR/xml-media-types/
>
> Anne
>
> On 7/28/06, Francisco Fernandez Velasco <ff...@nayadegroup.com>
wrote:
> > Excuse me Anne, but I have tried to use MTOM with document literal but I
> > didn´t know how. I don´t know how is the WSDL for support this.
> >
> > When I have tried to use MTOM, the WSDL2Java have generated methods that
> > receive OMElement object as parameters. But I NEED that the stub has
> methods
> > that receive DataBinding objects (for example EnqueueImage see WSDL
below)
> > as parameters.
> >
> > Any suggestion? Thanks
> >
> > Regards
> >
> > -----Mensaje original-----
> > De: Anne Thomas Manes [mailto:atmanes@gmail.com]
> > Enviado el: viernes, 28 de julio de 2006 16:27
> > Para: axis-dev@ws.apache.org
> > Asunto: Re: SwA Axis2 implementation swaRef document literal
> >
> > As long as you're using Axis2, I suggest using MTOM rather than SwA.
> >
> > Anne
> >
> > On 7/28/06, Francisco Fernandez Velasco <ff...@nayadegroup.com>
> wrote:
> > >
> > >
> > >
> > >
> > > Thanks Rudolf. But seems that with Axis2 the generated Stub doesn´t
have
> > the
> > > addAttachment method, so I don´t know how to send the image and I
cannot
> > use
> > > the DataHandler.
> > >
> > >
> > >
> > > Thanks again. Regards
> > >
> > >
> > >
> > >  ________________________________
> > >
> > >
> > > De: Rudolf Pailer [mailto:r.pailer@a1.net]
> > >  Enviado el: viernes, 28 de julio de 2006 13:32
> > >  Para: axis-dev@ws.apache.org
> > >  Asunto: AW: SwA Axis2 implementation swaRef document literal
> > >
> > >
> > >
> > >
> > > Hello Francisco!
> > >
> > >
> > >
> > > have a look at
> > >
> > > http://www.mail-archive.com/axis-user@xml.apache.org/msg08732.html
> > >
> > >
> > >
> > > regards
> > >
> > > Rudolf
> > >
> > >
> > >
> > >  ________________________________
> > >
> > >
> > > Von: Francisco Fernandez Velasco [mailto:ffernandez@nayadegroup.com]
> > >  Gesendet: Freitag, 28. Juli 2006 13:07
> > >  An: axis-dev@ws.apache.org
> > >  Betreff: SwA Axis2 implementation swaRef document literal
> > >
> > >   I need send an image to a webservice (document/literal) using SwA
and
> > > not base64 enconding because of performance problems.
> > >
> > > I have defined the next WSDL following the WS-I Profile:
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > > xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/">
> > >     <types>
> > >         <xsd:schema
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
> > > elementFormDefault="qualified">
> > >              <xsd:import
> > > namespace="http://ws-i.org/profiles/basic/1.1/xsd"
> > > schemaLocation="http://ws-i.org/profiles/basic/1.1/xsd"/>
> > >             <xsd:element name="emptyResponse">
> > >                 <xsd:complexType/>
> > >             </xsd:element>
> > >             <xsd:element name="enqueueImage">
> > >                 <xsd:complexType>
> > >                     <xsd:sequence>
> > >                         <xsd:element name="meta-info"
> > > type="xsd:string"/>
> > >                         <xsd:element name="image-attachment"
> > > type="wsi:swaRef"/>
> > >                     </xsd:sequence>
> > >                 </xsd:complexType>
> > >             </xsd:element>
> > >         </xsd:schema>
> > >     </types>
> > >     <message name="enqueueImageRequest">
> > >         <part name="image" element="enqueueImage"/>
> > >     </message>
> > >     <message name="emptyResponse"/>
> > >     <portType name="XXXPortType">
> > >         <operation name="enqueue_image">
> > >             <input name="image"
> > > message="tns:enqueueImageRequest"/>
> > >             <output name="empty" message="tns:emptyResponse"/>
> > >         </operation>
> > >     </portType>
> > >     <binding name="XXXBinding" type="XXXPortType">
> > >         <soap:binding style="document"
> > > transport="http://schemas.xmlsoap.org/soap/http"/>
> > >         <operation name="enqueue_image">
> > >             <soap:operation soapAction=""/>
> > >             <input>
> > >                 <soap:body use="literal"/>
> > >             </input>
> > >             <output>
> > >                 <soap:body use="literal"/>
> > >             </output>
> > >         </operation>
> > >     </binding>
> > >     <service name="XXXSwA">
> > >         <port name="XXXPortType" binding="XXXBinding">
> > >             <soap:address location="http://"/>
> > >         </port>
> > >     </service>
> > > </definitions>
> > >
> > > When I run WSDL2Java (xmlbeans data binding) it's generated a
> > > EnqueueImage object with a method waiting for a SwaRef object and I
> don´t
> > > know
> > > what to do with it:
> > >
> > > void
> > > xsetImageAttachment(org.ws_i.profiles.basic._1_1.xsd.SwaRef
> > > imageAttachment)
> > >
> > > I don´t know where to add the image that I want to send to the
> > > WebService.
> > >
> > > Thanks and Regards.
> > > Fran.
> > >
> > >
> > >
> > >  ------------------------------
> > >  email scanned by Ikarus ContentWall
> > >  filename: mailbody --> clean
> > >  filename: mailbody(html) --> clean
> > >  SCANMODULE: Ikarus vdb: 27.07.2006(67671) version: 0.2.65.0
> > >  ------------------------------
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-dev-help@ws.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-dev-help@ws.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org