>From the service WSDL, you should do call.setTargetObjectURI("http://www.webserviceX.NET/");
This will lead to another error, however, since the service uses document/literal encoding. Apache SOAP only supports rpc/encoded directly. You can write a client to talk to the service with Apache SOAP, but you have to create the SOAP envelope manually. Microsoft has a HOW TO on this at http://support.microsoft.com/default.aspx?scid=kb;en-us;Q308466. Scott Nichol ----- Original Message ----- From: "Gaytri Thange" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 09, 2002 8:06 AM Subject: need your help for trying to understand the error while invoking a webservice method from a client Hi! I am writing an Apache SOAP client to acces a webservice. I was able to execute a sample client provided for a CurrencyExchange webservice available on www.xmethods.com <http://www.xmethods.com>. But have some problems coding & executing a client for the CurrencyConvertor available on the same site. Below are the lines coded to invoke a method on it: URL url = new URL("<http://www.webservicex.net/CurrencyConvertor.asmx>"); Call call = new Call (); double rate=0; Gaytri Thange | Software Engineer | netdecisions > Mumbai Software Development Centre 6th Floor, MET Building, Gen. A K Vaidya Chowk, Bandra Reclamation, Mumbai 400050, India > t +91 (0)22 644 0000 f +91 (0)22 655 8048 www.netdecisions.com [EMAIL PROTECTED] SOAPHTTPConnection con = new SOAPHTTPConnection(); con.setProxyHost("10.9.64.9"); con.setProxyPort(8080); call.setSOAPTransport(con); call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); call.setTargetObjectURI("urn:webserviceX-CurrencyConvertor"); call.setMethodName("ConversionRate"); Vector params = new Vector (); params.addElement (new Parameter("fromCurrency", String.class, fromCurrency , null)); params.addElement (new Parameter("toCurrency", String.class, toCurrency, null)); call.setParams (params); SOAPMappingRegistry smr = new SOAPMappingRegistry (); Deserializer sd1 = new XMLParameterSerializer(); smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "fromCurrency"), String.class, null, sd1); smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "toCurrency"), String.class, null, sd1); call.setSOAPMappingRegistry(smr); System.out.println("invoke the method call"); Response resp = call.invoke(url,"<http://www.webserviceX.NET/ConversionRate>"); System.out.println("response received"); if (resp.generatedFault()) { Fault fault=resp.getFault(); System.out.println(" Fault code: " + fault.getFaultCode()); System.out.println(" Fault string: "+fault.getFaultString()); } else { Parameter result=resp.getReturnValue(); Double value = (Double)result.getValue(); rate = value.doubleValue(); } Following is the stack trace for the exception thrown when i try to invoke the method on the webservice: Fault string: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (5, 2). ---> System.Xml.XmlException: Invalid namespace declaration. Line 5, position 25. at System.Xml.XmlNSAttributeTokenInfo.FixNSNames() at System.Xml.XmlTextReader.SetLiteralValues(XmlAttributeTokenInfo fld) at System.Xml.XmlTextReader.SetAttributeValues() at System.Xml.XmlTextReader.ParseElement() at System.Xml.XmlTextReader.Read() at System.Xml.XmlLoader.LoadChildren(XmlNode parent) at System.Xml.XmlLoader.LoadElementNode() at System.Xml.XmlLoader.LoadCurrentNode() at System.Xml.XmlLoader.ReadCurrentNode(XmlDocument doc, XmlReader reader) at System.Xml.XmlDocument.ReadNode(XmlReader reader) at System.Xml.Serialization.XmlSerializationReader.UnknownNode(Object o) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read2_ ConversionRate() --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() --- End of inner exception stack trace --- at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.Invoke() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() Can you kindly let me know what is it that I am missing out or doing wrong. Thanks, > Gaytri Thange | Software Engineer | netdecisions > Mumbai Software Development Centre 6th Floor, MET Building, Gen. A K Vaidya Chowk, Bandra Reclamation, Mumbai 400050, India > t +91 (0)22 644 0000 f +91 (0)22 655 8048 www.netdecisions.com [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>