469,327 Members | 1,238 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

How can i send parameters in java client to .net web service

Hi, i have a problem, I have a Java Client and i call my webservice on
..NET.

This run perfectly just except when i send parameters don't work fine.

I send my code :
This is my java client..........

import java.io.*;
import java.util.*;
import java.net.*;
import org.w3c.dom.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;
import org.apache.soap.transport.http.SOAPHTTPConnection;

public class TpmClient {

public static void main(String[] args) throws Exception {

URL url = new URL ("http://localhost/InterfazTpm/InterfazTpm.asmx");

SOAPMappingRegistry smr = new SOAPMappingRegistry ();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "Result"),
null, null, sd);

// create the transport and set parameters
SOAPHTTPConnection st = new SOAPHTTPConnection();

// build the call.
Call call = new Call ();
call.setSOAPTransport(st);
call.setSOAPMappingRegistry (smr);

call.setTargetObjectURI ("http://tempuri.org/message/");
call.setMethodName("GenerarTpm");
call.setEncodingStyleURI
("http://schemas.xmlsoap.org/soap/encoding/");

Vector params = new Vector();
params.addElement(new Parameter("cdinfo", int.class, "9396", null));
params.addElement(new Parameter("numeroorden", int.class, "213100",
null));
call.setParams(params);

Response resp = null;
try {
resp = call.invoke (url, "http://tempuri.org/GenerarTpm");
}

catch (SOAPException e) {
System.err.println("Caught SOAPException (" + e.getFaultCode () +
"): " + e.getMessage ());
return;
}

// check response
if (resp != null && !resp.generatedFault()) {
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();

System.out.println ("Answer--> " + value);
}
else {
Fault fault = resp.getFault ();
System.err.println ("Generated fault: ");
System.out.println (" Fault Code = " + fault.getFaultCode());
System.out.println (" Fault String = " + fault.getFaultString());
}
}
}

this is my web service................

public class InterfazTpm : System.Web.Services.WebService
{
public InterfazTpm()
{

InitializeComponent();
}

private IContainer components = null;
private void InitializeComponent()
{
}
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion

[WebMethod]
public string GenerarTpm(int cdinfo,int numeroorden)
{

CTpm OrderTpm =new CTpm(cdinfo,numeroorden);

return ("Tpm Generado"+numeroorden);
}
}
}
I like know where is the error or how can i resolve to recieve the
parameters.

Please answer me, i don't know what to do now

Mar 2 '06 #1
0 1999

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by James Hong | last post: by
reply views Thread by MaDukhiSaa | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.