Skip to Content
0
Former Member
Mar 19, 2007 at 11:10 AM

Cannot Read Payload on Java Program

13 Views

I created a SOAP-XI-RFC scenario and tested it on RWB and everything is fine. But when created and ran a Java program, I'm having a "CANNOT_READ_PAYLOAD" from the SXMB_MONI. Please help.

The program are as follows:

import java.io.BufferedWriter;

import java.io.File;

import java.io.FileWriter;

import java.io.InputStream;

import java.text.SimpleDateFormat;

import java.util.Calendar;

import java.util.Date;

import javax.xml.namespace.QName;

import javax.xml.rpc.ParameterMode;

import org.apache.axis.Message;

import org.apache.axis.encoding.XMLType;

import org.apache.axis.message.SOAPEnvelope;

/*

  • Created on Mar 12, 2007

*

  • TODO To change the template for this generated file go to

  • Window - Preferences - Java - Code Style - Code Templates

*/

/**

  • @author p8admin

*

  • TODO To change the template for this generated type comment go to

  • Window - Preferences - Java - Code Style - Code Templates

*/

public class Test_WebService {

public static String createRequest(String CompanyCode, String

ContractNo, String ExtDate){

String rqt = "<soap-env:Envelope

xmlns:soap-env=\"http://schemas.xmlsoap.org/soap/envelope/\"" +

" xmlns:ns0=\"urn:xi:ptc:ali:poc\">" +

"<soap-env:Header/>" +

"<soap-env:Body>" +

"<ns0:REP_MSG_TYPE> " +

"<CompanyCode>" +CompanyCode

+ "</CompanyCode>" +

"<ContractNo>"ContractNo"</ContractNo>" +

"<ExtDate>" +

Calendar.getInstance().getTime() + "</ExtDate>"+

"</ns0:REP_MSG_TYPE>" +

"</soap-env:Body>" +

"</soap-env:Envelope>";

/*String rqt = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +

"<ns0:REP_MSG_TYPE xmlns:ns0=\"urn:xi:ptc:ali:poc\">" + "<CompanyCode

type=\"xsd:string\">" +CompanyCode + "</CompanyCode>" + "<ContractNo

type=\"xsd:string\">"ContractNo"</ContractNo>" + "<ExtDate

type=\"xsd:date\">" + "" + "</ExtDate></ns0:REP_MSG_TYPE>";*/

return rqt;

}

public static String call_REP_WS(String CompanyCode,String

ContractNo,String ExtDate){

String errmsg = "";

String ret = "";

System.out.println("Starting");

// set weblogic ServiceFactory

try{

String endpointURL =

"http://alixidvs:50000/XISOAPAdapter/MessageServlet?channel=:PTC_REP_INTEGRAT

ION:WS_REP_OUT";

System.out.println("ENDPOINT: " + endpointURL);

String requestString = createRequest(CompanyCode,ContractNo,ExtDate);

System.out.println(requestString);

org.apache.axis.client.Service service = new

org.apache.axis.client.Service();

SOAPEnvelope sd = new SOAPEnvelope();

BufferedWriter out2 = new BufferedWriter(new FileWriter(

"

192.168.79.46
Shared_txt
REP_Expired_" + new

SimpleDateFormat("MMddyyyy").format(new Date()) + ".xml"));

out2.write(requestString);

out2.close();

File path = new File("

192.168.79.46
Shared_txt
REP_Expired_" + new

SimpleDateFormat("MMddyyyy").format(new Date()) + ".xml");

org.apache.axis.client.Call call = (org.apache.axis.client.Call)

service.createCall();

call.setUsername("someusername");

call.setPassword("somepassword");

call.setTargetEndpointAddress(new java.net.URL(endpointURL));

call.setOperationName(new QName(

endpointURL,

"REP_WS_MSG_INF"));

Message msg = new Message((Object)(requestString));

//call.setRequestMessage(msg);

call.setOperation("REP_WS_MSG_INF");

call.setSOAPActionURI("http://alixidvs:50000/XISOAPAdapter/MessageServlet?cha

nnel=:PTC_REP_INTEGRATION:WS_REP_OUT&version=3.0&Sender.Service=PTC_REP_INTEG

RATION&Interface=urn%3Axi%3Aptc%3Aali%3Apoc%5EREP_WS_MSG_INF");

call.addParameter("REP_MSG_TYPE", XMLType.XSD_STRING,

ParameterMode.INOUT);

//call.addParameter("ContractNo", XMLType.XSD_STRING, ParameterMode.IN);

//call.addParameter("ExtDate", XMLType.XSD_DATE, ParameterMode.IN);

call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);

Object xxi[] = new Object[1];

/*xxi[0] =(Object) CompanyCode;

xxi[1] =(Object) ContractNo;

xxi[2] =(Object) ExtDate;*/

xxi[0] = (Object) requestString;

ret = (String)call.invoke(new Object[] {requestString});

//call.invoke();

System.out.println(ret);

}catch(Exception e){

System.out.println("Error: " + e.getMessage());

errmsg = e.getLocalizedMessage();

e.printStackTrace();

}

System.out.println("hello");

System.out.println("ret = "+ret);

return errmsg;

}

public static void main(String[] args){

System.out.println(call_REP_WS("1000","1000000000111",new

SimpleDateFormat("MM/dd/yyyy").format(new Date())));

//

}

}