Closed Bug 294890 Opened 19 years ago Closed 14 years ago

get a SOAP fault everytime I use a SOAPCall with namespaced parameters to call a web service method

Categories

(Core Graveyard :: Web Services, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: dichev, Unassigned)

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

For the SOAPCall, I used the turotial on 
http://www.oreillynet.com/pub/a/javascript/synd/2002/08/30/mozillasoapapi.html?
page=3
The web service has implementations in C# and Java. Working clients for both 
exist.


Reproducible: Always

Steps to Reproduce:
1. (holding to the  tutorial mentioned above) create a SOAPCall to call the 
method "continueGame" , which requires input parameters "guessedAnswer" 
and "sessionId", namespaces and action can be taken from the wsdl. 
url of wsdl for C# implementation:
http://dotnet.rus.uni-
stuttgart.de/ws_konrad/eAssessmentQuizBasic/QuizService.asmx?WSDL
url of wsdl for Java implementation:
http://dotnet.rus.uni-stuttgart.de:9006/statefulquiz/quiz?WSDL

Actual Results:  
Here is the SOAP fault I get for each version of the service.

a) SOAP fault: Client. ... deserialization error. Unexpected XML reader state. 
end expected , guessedAnswer found (JAXRPC implementation)
b) SOAP fault: Server. ... server was unable to process request. object 
referenece not set to an instance of an object. (C# implementation)

Expected Results:  
a SOAPResponse which does not contain a SOAP fault, but the actual result of my 
SOAP call 

I know exactly how to make the SOAP call work: I have to add the namespace of 
the service for each parameter used. Unfortunately, explicitly setting 
namespace:guessedAnswer as a parameter instead of guessedAnswer just cuts off 
everything up to the ":" . 

1. I shouldn't have to do it, really.
2. If I have to, then why doesn't the implementation allow it?
-> Core: Web Services
Assignee: nobody → web-services
Component: General → Web Services
Product: Firefox → Core
QA Contact: general → doronr
Version: unspecified → Trunk
Can you paste a working SOAP request from some other client?

We send:
...
<continueGame xmlns="http://ws.hlrs.de/statefulquiz/QuizService">
  <String_1 xsi:type="xs:string">test</String_1>
  <String_2 xsi:type="xs:string">test</String_2>
</continueGame>
...

which strictly speaking is correct per spec - xmlns="..." gets inherited by the
children.  If C# and some java impls use a crappy XML decoder, then we might
have to change to add the xmlns to all parameters as well.

Using Mozilla's WSDL proxying (no need to use the SOAP API), the server sends back:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns0="http://ws.hlrs.de/statefulquiz/QuizService"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>JAXRPCTIE01:
caught exception while handling request: deserialization error: unexpected XML
reader state. expected: END but found: START:
{http://ws.hlrs.de/statefulquiz/QuizService}String_1</faultstring></env:Fault></env:Body></env:Envelope>
Status: UNCONFIRMED → NEW
Ever confirmed: true
OK, I have to revise my statement: the problem without namespaced parameters
occurrs only in the C# implementation. In the java version, when giving String_1
and String_2 as parameters, it normally works. I will paste you a client I wrote
to keep it as simple as possible to show the bug:
You need to do only this to test it: 
1. start FireFox with -console for the message output
2. load the pasted script from a javascript shell (I do this with the shell of
the extension developer's extension)
3. in last line of callWS_XmlHttpRequest(), have
xmlhttp.send(stringWITHnamespacedParameters) or
xmlhttp.send(stringWITHOUTnamespacedParameters)
As you can notice, the only difference is that in stringWITH... , the parameters
are namespaced as well
4. just execute all(); when using stringWITH.. , the reponse is telling you you
did answer right or wrong. when using stringWITHOUT..., server SOAP fault is thrown.

/*wsdl and namespace for java implementation of the web service are commented,
don't change this to see the C# implementation problem*/
var myNamespace =
"http://quiz.jacomac.de/statefulquiz/"/*"http://ws.hlrs.de/statefulquiz/QuizService"*/;
var myWsdlUrl =
"http://dotnet.rus.uni-stuttgart.de/ws_konrad/eAssessmentQuizBasic/QuizService.asmx?WSDL"/*"http://dotnet.rus.uni-stuttgart.de:9006/statefulquiz/quiz?WSDL"*/;
var theResponse = new SOAPResponse();
var sessionId = "";
function callWS(nameSpace,method,params,wsdlUrl)
{
  try {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
  } catch (e) {
      alert(e);
    return false;
  }
  var soapCall = new SOAPCall();
  soapCall.transportURI = wsdlUrl;
    var headers = new Array();
  soapCall.actionURI=nameSpace + method;

  soapCall.encode(0,method,nameSpace,headers.length,headers,params.length,params);
  var serializer = new XMLSerializer();
  var data =  "SOAP Call : \n" + serializer.serializeToString(soapCall.message)
+ '\n';
  dump(data);
  theResponse = soapCall.invoke();
  data = "SOAP Response : \n" +
serializer.serializeToString(theResponse.message) + '\n';
  dump(data);
}
function callWS_XmlHttpRequest(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST",
"http://dotnet.rus.uni-stuttgart.de/ws_konrad/eAssessmentQuizBasic/QuizService.asmx",true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   dump("SOAP Response " + xmlhttp.responseText);
  }
 }
 xmlhttp.setRequestHeader("Man", "POST
http://dotnet.rus.uni-stuttgart.de/ws_konrad/eAssessmentQuizBasic/QuizService.asmx
HTTP/1.1");
 xmlhttp.setRequestHeader("MessageType", "CALL");
 xmlhttp.setRequestHeader("Content-Type", "text/xml");
 xmlhttp.setRequestHeader("SOAPAction",myNamespace+"continueGame");

 var stringWITHnamespacedParameters = '<env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xs="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"><env:Header/><env:Body><a0:continueGame
xmlns:a0="http://quiz.jacomac.de/statefulquiz/"><a0:guessedAnswer
xsi:type="xs:string">a</a0:guessedAnswer><a0:sessionId
xsi:type="xs:string">'+sessionId+'</a0:sessionId></a0:continueGame></env:Body></env:Envelope>';
 var stringWITHOUTnamespacedParameters = '<env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xs="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"><env:Header/><env:Body><a0:continueGame
xmlns:a0="http://quiz.jacomac.de/statefulquiz/"><guessedAnswer
xsi:type="xs:string">a</guessedAnswer><sessionId
xsi:type="xs:string">'+sessionId+'</sessionId></a0:continueGame></env:Body></env:Envelope>';
 dump("SOAP Call " + stringWITHOUTnamespacedParameters);
 /*taking WITH namespaced parameters works, WITHOUT doesn't*/
 xmlhttp.send(stringWITHnamespacedParameters);
 }

function all(){
var params = new Array();
callWS(myNamespace,"startNewGame",params,myWsdlUrl);
if (theResponse == false)
    {alert("response is false");}
else{
    sessionId =
theResponse.body.getElementsByTagName("sessionId").item(0).firstChild.nodeValue;
    /*following 2 lines work for the java- implemented web service, otherwise
the 3. line with namespaced parameters
    (see callWS_XmlHttpRequest) for the C# implementation*/
    //params = new Array(new SOAPParameter("a","String_1"), new
SOAPParameter(sessionId,"String_2"));
    //callWS(myNamespace,"continueGame",params,myWsdlUrl);
    callWS_XmlHttpRequest();   
}
alert('ready');
}
Assignee: web-services → nobody
QA Contact: doronr → web-services
We dropped SOAP.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.