Yes I read the guide but I need a more complete example.
In my MTOM implementation I did not used a base64 encoded string.. I simply
did:
public OMElement getPriceFile(OMElement element) throws XMLStreamException {
element.build();
element.detach();
OMElement fileNameElement = element.getFirstElement();
String fileName = "C:\\Programmi\\" + fileNameElement.getText();
System.out.println("fileName = " + fileName);
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs =
fac.createOMNamespace("http://quickstart.samples/xsd", "ns");
OMElement fileElement = fac.createOMElement("file", omNs);
FileDataSource dataSource =
new FileDataSource(fileName);
DataHandler dataHandler = new DataHandler(dataSource);
// create an OMText node with the above DataHandler and set
optimized to true
OMText textData = fac.createOMText(dataHandler, true);
fileElement.addChild(textData);
OMElement response = fac.createOMElement("getPriceFileResponse",
omNs);
OMElement priceFile = fac.createOMElement("priceFile", omNs);
priceFile.addChild(textData);
response.addChild(priceFile);
return response;
}
And it does work wheter I transfer a txt, a pdf, a jpg......
The WSDL currently defines:
<xs:element name="getPriceFileResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="priceFile" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
Is this bad?
Thanks
On 4/20/07, Thilina Gunarathne <[EMAIL PROTECTED]> wrote:
> I have question about the WSDL for the MTOM-based service... For the
> operation which has a parameter which is a binary file, which type
> should I declare for the parameter? string?
base64Binary..
You may refer to here[1] as a guide...
Thanks,
Thilina
[1] http://ws.apache.org/axis2/1_1_1/mtom-guide.html#25
>
> In my enhanced StockQuoteservice.wsdl (which has a getPriceFile method
> which receives a file name as input and returns a priceFile as
> outpput), I wrote:
>
> <wsdl:types>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> attributeFormDefault="qualified" elementFormDefault="qualified"
> targetNamespace="http://quickstart.samples/xsd">
> <xs:element name="getPriceFile">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="priceFileName"
nillable="true" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="getPriceFileResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="priceFile"
nillable="true" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
>
> Is this correct?
>
> Thank you very much
>
>
> >
> >
[1]http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/deprecated/mtomsample/
> > [2]ws.apache.org/commons/tcpmon
> > --
> > Thilina Gunarathne - http://www.wso2.com -
http://thilinag.blogspot.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Michele Amoretti, Ph.D.
> Distributed Systems Group
> Dipartimento di Ingegneria dell'Informazione
> Università degli Studi di Parma
> http://www.ce.unipr.it/amoretti
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Thilina Gunarathne - http://www.wso2.com - http://thilinag.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Michele Amoretti, Ph.D.
Distributed Systems Group
Dipartimento di Ingegneria dell'Informazione
Università degli Studi di Parma
http://www.ce.unipr.it/amoretti