How to Create an MTOM Web Service Component |
this=new com.usoft.WebServiceClient.WSClient() this.setEndpointURL((U):0) this.setInputFolder((U):1) this.setOutputFolder((U):2)
•url represents the access point of the web service (SOAP address location in the WSDL file). •input_folder represents the folder where the input files are located. •output_folder represents the path to the location where the binary data received from the web service will be saved as files. The output folder can be omitted if the files are saved in the current directory. To omit the output folder, remove this.setOutputFolder((U):2) from the physical path this.setEndpointURL((U):0) this.setInputFolder((U):1)
SELECT 'http://www.test.com/TestingMtom', 'C:/Input/', 'C:/Output'
this.sendSOAPMessage((U) :0, (U) :1, (U) :2)
•body represents the body of your SOAP message. The element that contains binary data must have as a subelement a USoft processing instruction that will specify that that element contains binary data in MTOM format: •<?usoft-mtom path="path to the file that will be sent as binary with the message"?>. •If there is a input_folder specified in constructor than the path can be only the file name, otherwize the path should be the absolute path of the file. Example: <MTOMM-essage xmlns="http://www.test.com/TestMtom/v1"> <request> <BinaryData><?usoft-mtom path="TestMTOM.doc"?></BinaryData> </request>
•header represents the header of the soap message •SoapAction represents the SOAPAction HTTP header. You can now execute a call to this service in your application: INVOKE <web service component name>.<method name> WITH SELECT '<MTOMMessage xmlns="http://www.test.com/TestMtom/v1"> <request> <BinaryData><?usoft-mtom path="TestMTOM.doc"?></BinaryData> </request> </ MTOMMessage >', null, 'http://www.test.com/TestMtom/action1'
If the response has binary data in MTOM encoding, that data will be saved into files. The files are saved in the location specified by the output folder in the constructor method. The (unique) file names are generated by USoft without extensions and they will be returned in a USoft processing instruction in the element where the binary data should be. Example of response: <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" > <soap:Body> <MTOMResponse xmlns="http://www.test.com/TestMtom/v1"> <result> <BinaryData> <?usoft-mtom path="C:\Output\2d33366539343139613a31313161333034366335373a2d37666666_20070330152414114"?> </BinaryData> </result> </ MTOMResponse> </soap:Body> </soap:Envelope> |