I would say this is an MS bug. I am no XML expert but as long as the "ns1"
namespace is correctly declared, as it appears to be, and the message is
well formed and valid XML the server should not care.

Rick

> -----Original Message-----
> From: Pete Roth [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 26, 2001 8:15 AM
> To: Soap-dev List (E-mail)
> Subject: response from method is zero in my Apache Java client
> 
> 
> Ok I am still having this problem.  I am passing two values to the MS
> (Microsoft .NET beta 2) SOAP server to a method, "test_AddThem" which
> returns, gasp, the value of the two numbers added together.  
> If I pass the
> exact XML the server requires, using an example without the 
> Apache libraries
> which passes a static XML file, the server responds 
> correctly.  If I use the
> Apache libraries to build the XML, the server returns zero as 
> the response.
> 
> 
> I've found out now exactly what the difference in the XML is 
> that is causing
> the value to be returned to be incorrect.  I don't know how 
> to make the
> Apache libraries generate the 'correct' XML so that the MS server will
> understand it. 
> 
> The MS server does not like the "ns1" (namespace?) being added to the
> test_AddThem element. 
> 
> Here is the XML that works:
> <?xml version='1.0' encoding='UTF-8'?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
> xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
>   <SOAP-ENV:Body>
>     <test_AddThem xmlns="http://telemetrytech.net/VnocngWebService";
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
>       <FirstNum xsi:type="xsd:int">3</FirstNum>
>       <SecondNum xsi:type="xsd:int">17</SecondNum>
>     </test_AddThem>
>   </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> Here is the XML generated by the apache libraries that results in zero
> returned as the answer:
> <?xml version='1.0' encoding='UTF-8'?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
> xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
>   <SOAP-ENV:Body>
>     <ns1:test_AddThem 
> xmlns:ns1="http://telemetrytech.net/VnocngWebService";
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
>       <FirstNum xsi:type="xsd:int">3</FirstNum>
>       <SecondNum xsi:type="xsd:int">17</SecondNum>
>     </ns1:test_AddThem>
>   </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> Do you notice the difference?  The 'ns1' appended to the 
> "test_AddThem"
> method.  Here is the response from the first XML listing, the one that
> works:
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:xsd="http://www.w3.org/2001/XM
> LSchema">
>   <soap:Body>
>     <test_AddThemResponse 
> xmlns="http://telemetrytech.net/VnocngWebService";>
>       <test_AddThemResult>20</test_AddThemResult>
>     </test_AddThemResponse>
>   </soap:Body>
> </soap:Envelope>
> 
> This would be the response with the from the first XML listing.  The
> response from the Apache generated XML is exactly the same 
> except the value
> returned instead of 20 is 0.  
> 
> Some reason the MS server doesn't like that "ns1" being 
> appended to the
> beginning of the "test_AddThem" element name.  I don't know 
> enough about XML
> to understand why the Apache libraries are generating this XML.  
> 
> Does anyone know of a fix for this?  If someone knows how to 
> use the Apache
> SOAP libraries to not add that "ns1" that would be great.  If 
> there are any
> other solutions that would be great as well.  
> 
> I've been trying to solve this problem for about 2.5 days 
> now, if anyone can
> help me I will greatly appreciate it.  Oh, and my Java client 
> is listed
> below if anyone would like to see it.
> 
> Thanks
> 
> Peter Roth
> Telemetry Technologies Inc.
> p: 404.231.0021 ext. 1290
> e: [EMAIL PROTECTED]
> 
> 
> 
> ----Rick Hansen Wrote:----
> 
> List:     soap-dev
> Subject:  RE: response contains zero when should be a value 
> in my Apache Ja
> From:     "Hansen, Richard" <[EMAIL PROTECTED]>
> Date:     2001-07-24 19:49:50
> 
> Is "test_AddThemResult" the correct name of the XML element 
> the response is
> comming back in? Have you used the TCPTunnelGui to verify the 
> XML that is
> comming back? That's all I can think of. 
> 
> Rick Hansen
> 
> ----Wang, Xinju Wrote:----
> 
> List:     soap-dev
> Subject:  RE: response contains zero when should be a value 
> in my Apache Ja
> From:     "Wang, Xinju" <[EMAIL PROTECTED]>
> Date:     2001-07-24 19:31:34
> 
> 
> see this article.
>  http://www.perfectxml.com/articles/xml/soapguide.asp
> 
> Apache SOAP doesn't like a response without xsi:type. This is a known
> interop issue between Apache client and MS server. Also an Integer
> serializer (and a lot others) is built in SOAPMappingRegistry for SOAP
> encoding style. You don't have to set your IntSerializer.
> 
> Hope this helps.
> Xinju
> 
> -----Original Message-----
> From: Pete Roth [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 24, 2001 12:14 PM
> To: Soap-dev List (E-mail)
> Subject: response contains zero when should be a value in my 
> Apache Java
> c lient to a MS server
> 
> 
> 
> I am getting bogus data back from my IIS .NET beta 2 
> WebService.  I am using
> the Java client below, which calls a method (test_AddThem) to add two
> numbers and return the result.  This result is always a '0' 
> (zero).  I have
> another version of this method which adds the xsi:type 
> attribute to each
> element in the returned XML, since Microsoft's server does 
> not normally do
> this.  This method works fine and returns the correct result.
> 
> I am adding to the mapping registry the deserializer to 
> deserialize the
> 'test_AddThemResponse' response element as an Integer yet I 
> still get zero
> as the result.
> 
> I have been trying to find my bug for about 4 hours now with 
> no luck.  Could
> someone help me out?  I will be very grateful.  Thanks.
> 
> 
> 
> Peter Roth
> Telemetry Technologies Inc.
> p: 404.231.0021 ext. 1290
> e: [EMAIL PROTECTED]
> 
> **************************************************************
> **************
> *****
> JAVA CLIENT
> 
> package com.telemetrytech.utils;
> /**
>  * SoapAddTest.java
>  * A class to use the SOAP method test_AddThem on the VNOC server
>  * via Java.  This method takes two numbers and returns the 
> result of adding
>  * the two together.
>  * @author Peter Roth (c) Telemetry Technologies 2001
>  */
> 
> import java.io.*;
> import java.net.*;
> import java.util.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
> import org.apache.soap.util.xml.*;
> import org.apache.soap.encoding.*;
> import org.apache.soap.encoding.soapenc.*;
> 
> public class SoapAddTest {
> 
>       public static void main(String args[]) {
>                       //Read in the arguments to add
>                       if(args.length < 2) { 
>                                       System.err.println("USAGE java
> SoapAddTest firstNum secondNum"); 
>                                       return; 
>                       }
> 
>                       Integer firstNum  = new Integer (5);
>                       Integer secondNum = new Integer(10);
>                       try {
>                                       firstNum  = new Integer 
> (args[0]);
>                                       secondNum = new 
> Integer(args[1]);
>                       }catch(NumberFormatException e) {
>                                       
> System.out.println("Number Format
> Exception\n");
>                                       e.printStackTrace();
>                                       return;
>                       }
> 
>                       //now lets try and run the method on the server
>                       try {
>                                       //the url of the web service
>                                       URL url = 
>                                         new URL
> ("http://63.75.212.11/VnocngWebService/VnocngWebService.asmx";);
> 
>                                       Call call = new Call();
> 
>                                       //set the unique remote 
> object name
>       
> call.setTargetObjectURI("http://telemetrytech.net/VnocngWebService";); 
> 
>                                       //set the method name 
> and encoding
> style
>                                       call.setMethodName 
> ("test_AddThem");
>       
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>       
>                                       // Create the type 
> mapping registry 
>                                       SOAPMappingRegistry smr = new
> SOAPMappingRegistry(); 
>                                       IntDeserializer intDeSer= new
> IntDeserializer();
>                                       // Map the types. 
>       
> smr.mapTypes(Constants.NS_URI_SOAP_ENC, 
>                                                        new
> QName("http://telemetrytech.net/VnocngWebServic
> "test_AddThemResult"), 
>                                                        null, null,
> intDeSer); 
>                                       
> call.setSOAPMappingRegistry(smr); 
> 
>                                       //set up the parameters to the
> method
>                                       Vector params = new Vector ();
>                                       params.addElement (new
> Parameter("FirstNum", Integer.class, firstNum, null));
>                                       params.addElement (new
> Parameter("SecondNum", Integer.class, secondNum, null));
>                                       call.setParams (params);
> 
>       
> //System.err.println("HEADER:\n\n"+call.getHeader().toString()+"\n");
>       
> System.err.println("ENVELOPE:\n\n"+call.buildEnvelope().toStri
> ng()+"\n");
> 
>                                       //connect to the web 
> service and run
> the method getting the response back
>                                       Response resp = 
>       
> call.invoke(url,"http://telemetrytech.net/VnocngWebService/tes
> t_AddThem" );
> 
>                                       if (resp.generatedFault ()) {
>                                                       Fault fault =
> resp.getFault ();
>                                                       
> System.out.println
> ("Ouch, the call failed: ");
>                                                       
> System.out.println
> ("  Fault Code   = " + fault.getFaultCode ());  
>                                                       
> System.out.println
> ("  Fault String = " + fault.getFaultString ());
>                                       } else {
>                                                       
> Parameter result =
> resp.getReturnValue();
>       
> System.out.println("\n"+resp.toString()+"\n");
>       
> System.out.println("result of "+ firstNum+ " + "+
>       
> secondNum+" = "+ result.getValue().toString() );
>                                       }
> 
>                       }catch(MalformedURLException e) {
>                                       System.out.println("error in URL
> creation.\n"+e.getMessage()+"\n");
>                                       e.printStackTrace();
>                                       return;
>                       }catch(SOAPException e) {
>       
> System.out.println("SOAPException\n");
>                                       e.printStackTrace();
>                                       return;
>                       }catch(Exception e) {
>                                       
> System.out.println("error in call
> creation.\n"+e.getMessage()+"\n");
>                                       e.printStackTrace();
>                                       return;
>                       }       
>       }
> }
> 
> END JAVA CLIENT
> **************************************************************
> **************
> ***********
> 
> 
> 
> 

Reply via email to