jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Java » Web Services
Bookmark "convert soap RPC call to document/literal" Watch "convert soap RPC call to document/literal" New topic

convert soap RPC call to document/literal

siebel admin

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"));
String destination = "http://XXXXX:0808/eai_enu/start.swe?SWEExtSource=WebService&SWEExtCmd=Execute&UserName=XXX&Password=XXXX";
SOAPMessage reply = connection.call(message, destination);

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

I agree. Here's the link: http://aspose.com/file-tools
subject: convert soap RPC call to document/literal
It's not a secret anymore!