| Author |
Problem in passing parameters through java client to .Net WS
|
chaitanya kiran pvn
Greenhorn
Joined: Nov 01, 2007
Posts: 25
|
|
MY SAMPLE CODE IS GIVEN BELOW,WHEN I SEPERATELY CALL THE WESERVICES URL AND GIVE THE PARAMETER I GOT PROPER RESULT,BUT WHEN I CALL THROUGH THE MY CODE GIVEN ERROR CODE Ie NO PARAMETER SEND.PLESE HELP ME IT VERY URGENT package WSClient; import javax.xml.namespace.QName; import javax.xml.rpc.Call; import javax.xml.rpc.ParameterMode; import javax.xml.rpc.Service; import javax.xml.rpc.ServiceFactory; import javax.xml.rpc.soap.SOAPFaultException; public class EcapayClient { /** * @param args */ public String response = ""; public EcapayClient(String targetNamespace, String serviceValue, String portValue, String operationValue, String soapAtion, String transIdName, String validationKeyName, String transIdValue, String validationKeyValue, String endPointAddress) { // TODO Auto-generated method stub try { targetNamespace = "http://payment.ecapay.com/"; serviceValue = "VerifySign"; portValue = "VerifySignSoap"; operationValue = "RunVerifySign"; soapAtion = "http://payment.ecapay.com/RunVerifySign"; transIdName = "TransactionID"; validationKeyName = "ValidationKey"; transIdValue = "2008101803017"; validationKeyValue = "Z6NFJV0T4"; endPointAddress = "http://payment.payuniq.com/WebService/VerifySign.asmx"; // Setup the global JAX-RPC service factory System.setProperty( "javax.xml.rpc.ServiceFactory","weblogic.webservice.core.rpc.ServiceFactoryImpl"); // create service factory ServiceFactory factory = ServiceFactory.newInstance(); // define qnames String NS_XSD = "http://www.w3.org/2001/XMLSchema"; QName QNAME_TYPE_STRING = new QName(NS_XSD, "string"); QName serviceName = new QName(targetNamespace,serviceValue); QName portName = new QName(targetNamespace, portValue); QName operationName = new QName(targetNamespace, operationValue); //URL wsdlLocation = new URL("http://payment.payuniq.com/WebService/VerifySign.asmx?WSDL"); // create service Service service = factory.createService(serviceName); // create call Call call = service.createCall(portName, operationName); call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true)); call.setProperty(Call.SOAPACTION_URI_PROPERTY, soapAtion); call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "http://schemas.xmlsoap.org/soap/encoding/"); call.setProperty(Call.OPERATION_STYLE_PROPERTY, "wrapped"); // add parameters call.addParameter(transIdName, QNAME_TYPE_STRING,ParameterMode.IN); call.addParameter(validationKeyName, QNAME_TYPE_STRING,ParameterMode.IN); call.setReturnType(QNAME_TYPE_STRING); //set end point address call.setTargetEndpointAddress(endPointAddress); // invoke the remote web service String result = (String) call.invoke(new Object[] {transIdValue,validationKeyValue}); //String result = (String) call.invoke(new Object[] {}); System.out.println("\n"); System.out.println(result); setResponse(result); } catch (Exception ex) { if (ex.getCause() instanceof SOAPFaultException) { SOAPFaultException fault = (SOAPFaultException)ex.getCause(); System.out.println("Remote Exception [Client] Fault Detail : " + fault.getDetail().toString()); System.out.println("Remote Exception [Client] Fault Actor : " + fault.getFaultActor()); System.out.println("Remote Exception [Client] Fault String : " + fault.getFaultString()); } System.out.println("Exception :"+ex); ex.printStackTrace(); } } public String getResponse() { return response; } public void setResponse(String response) { this.response = response; } public static void main(String[] args) { EcapayClient ecapayClient = new EcapayClient("String targetNamespace", "String serviceValue", "String portValue", "String operationValue", "String soapAtion", "String transIdName", "String validationKeyName", "String transIdValue", "String validationKeyValue", "String endPointAddress"); } }
|
 |
Yaron Naveh
Greenhorn
Joined: Oct 26, 2008
Posts: 24
|
|
|
You need to compare the soap envelope that this non-working client sends to the one a working client sends. When we have the difference we can check what is the problem. You can use a tool such as tcpmon or fiddler.
|
[url]http://webservices20.blogspot.com/[/url]
Web Services Performance, Interoperability And Testing Blog
|
 |
 |
|
|
subject: Problem in passing parameters through java client to .Net WS
|
|
|