Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Help in Webservices design Please

 
Preethi Krishna
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to develop a webservice to accept xml files and send string as response. I am using weblogic 10.0. So my thoughts are to use JAX-RPC with rpc literal binding and use mime attachments for xml files. I will create a wsdl and generate java class from wsdl and add the implementation in the java class generated. Please correct me if Iam wrong or let me know if there is any other way to implement the same. I am using webservices for first time. and my sample wsdl is

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://org.com.hc/WebServices/ServiceHandler/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://org.com.hc/WebServices/ServiceHandler/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
name="ServiceHandler"
targetNamespace="http://org.com.hc/WebServices/ServiceHandler/">

<wsdl:message name="Request">
<wsdl:part name="attachment_1" type="xsd:hexBinary"/>
</wsdl:message>
<wsdl:message name="Response">
<wsdl:part name="result" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="ServiceHandler">
<wsdlperation name="Attachment">
<wsdl:input message="tns:Request"/>
<wsdlutput message="tns:Response"/>
</wsdlperation>
</wsdl:portType>
<wsdl:binding name="ServiceHandlerSOAP" type="tns:ServiceHandler">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdlperation name="Attachment">
<soapperation soapAction="http://org.com.hc/WebServices/ServiceHandler/Attachment"/>
<wsdl:input>
<mime:multipartRelated>
<mime:part>
<soap:body use="literal"/>
</mime:part>
<mime:part>
<mime:content part="attachment_1" type="text/xml"/>
</mime:part>
</mime:multipartRelated>
</wsdl:input>
<wsdlutput>
<soap:body parts="result" use="literal"/>
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:service name="ServiceHandler">
<wsdl:port binding="tns:ServiceHandlerSOAP" name="ServiceHandlerSOAP">
<soap:address location="http://localhost:7001/Webservice/ServiceHandlerImpl/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Thanks,
Preethi
 
Preethi Krishna
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My main concern is I need to send large xml files so is it ok to send as mime or should I use any other option???

Thanks
Preethi
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Can't you use JAX-WS?
Attaching files to SOAP messages using SwA (SOAP with Attahcments) may provide a solution to your problem. If you could use MTOM, in order to compress the attachments, there may be gains to be made, especially if you are to send large files. The problem is that, as far as I know, JAX-RPC does not support MTOM.
Best wishes!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic