• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in passing parameters through java client to .Net WS

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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");
}

}
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic