File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes convert soap RPC call to document/literal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "convert soap RPC call to document/literal" Watch "convert soap RPC call to document/literal" New topic
Author

convert soap RPC call to document/literal

siebel admin
Greenhorn

Joined: Aug 05, 2012
Posts: 1
Hi Gurus,
I wrote a simple web service client with saaj API.The request gests posted as SOAP_RPC_CALL but the consuming application doesn't identify RPC calls, it only accepts SOAP_DOC_LITERAL.I tried to set mimeheaders to change the action to post as document, i get an error as

"Aug 5, 2012 11:03:50 AM com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post
SEVERE: SAAJ0008: Bad Response; Bad request"


===============================
package saagapiprogram;

import java.io.IOException;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;

public class SAAGAPIProgram {
public static void main(String[] args) throws SOAPException, IOException {
try {
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = factory.createConnection();
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
MimeHeaders hd = message.getMimeHeaders();
hd.addHeader("SOAPAction", "document/http://xmlns.oracle.com/apps/mdm/customer:lookupsiebel");
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
SOAPElement bodyElement = body.addChildElement(envelope.createName("lookupWallet_Input", "cus", "http://xmlns.oracle.com/apps/mdm/customer"));
bodyElement.addChildElement("aaaaa").addTextNode("Tssss");
message.saveChanges();
System.out.println("\nRequest:\n");
message.writeTo(System.out);
String destination = "http://XXXXX:0808/eai_enu/start.swe?SWEExtSource=WebService&SWEExtCmd=Execute&UserName=XXX&Password=XXXX";
SOAPMessage reply = connection.call(message, destination);
System.out.println("\nRESPONSE:\n");

TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
Source sourceContent = reply.getSOAPPart().getContent();
StreamResult result = new StreamResult(System.out);
transformer.transform(sourceContent, result);
System.out.println();
connection.close();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}

Thanks
Rama
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convert soap RPC call to document/literal