[Mono-bugs] [Bug 662368] New: Malformed Web Service SOAP Responses From XSP2 - XML Namespacing Incorrect

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jan 4 20:12:54 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=662368

https://bugzilla.novell.com/show_bug.cgi?id=662368#c0


           Summary: Malformed Web Service SOAP Responses From XSP2 - XML
                    Namespacing Incorrect
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Sys.Web.Services
        AssignedTo: atsushi at ximian.com
        ReportedBy: akrouskop at elogicgroup.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: No


Created an attachment (id=406966)
 --> (http://bugzilla.novell.com/attachment.cgi?id=406966)
Test Case Files Which Exploit the Bug

Description of Problem:

Web services hosted under XSP2, built from a stub generated using the Mono
wsdl.exe utility, return SOAP responses which do not conform to the interface
specified by the WSDL because the XML namespacing within them is wrong.

This incorrect behavior is not exhibited if the web service stub is built using
Microsoft's implementation of wsdl.exe and run under whatever the ASP.NET
implementation behind Visual Studio's test web server is.

A ZIP file containing the files which comprise a test case that exhibits this
incorrect behavior is attached.


Steps to reproduce the problem:
(See Test Case section below)

Actual Results:
(See Test Case section below)

Expected Results:
(See Test Case section below)


* Test Case *

** Quick & Dirty How-to-Test **

0. Extract the attached ZIP file.

1. Change directory into the ./mono/ directory of the extracted ZIP file.

2. Run $ ./build.sh
(just compiles the C# source using gmcs into a assembly in a new directory
/bin/)

3. Run $ ./run.sh
(starts xsp2)

4. Separately (while xsp2 continues to run), change directory into the ./test/
directory of the extracted ZIP file.

5 (optional) If xsp2 is running somewhere other than localhost:8080, edit the
first line of ./test.sh accordingly.

6. Run $ ./test.sh
(uses wget to POST a SOAP request to the web service running under XSP2, pipes
the result through xmllint to pretty print the it)


The expected result seen from running ./test.sh should be:

    <?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/XMLSchema">
      <soap:Body>
        <ExOperationResult xmlns="http://example.com/types">
          <ReturnId xmlns="">0</ReturnId>
          <ResultString1 xmlns="">1</ResultString1>
          <ResultString2 xmlns="">2</ResultString2>
          <ResultInt1 xmlns="">1</ResultInt1>
          <ResultInt2 xmlns="">2</ResultInt2>
          <ResultDate1 xmlns="">2011-01-04T17:52:05.1706484-05:00</ResultDate1>
          <ResultDate2 xmlns="">2011-01-04T17:52:05.1706484-05:00</ResultDate2>
        </ExOperationResult>
      </soap:Body>
    </soap:Envelope>



Note all the xmlns=""'s putting the inner most nodes back to having no
namespace.


The actual result under Mono/XPS2 is:

    <?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/XMLSchema">
      <soap:Body>
        <ExOperationResult xmlns="http://example.com/types">
          <ReturnId>0</ReturnId>
          <ResultString1>1</ResultString1>
          <ResultString2>1</ResultString2>
          <ResultInt1>1</ResultInt1>
          <ResultInt2>1</ResultInt2>
          <ResultDate1>2011-01-04T17:48:04.4703583-05:00</ResultDate1>
          <ResultDate2>2011-01-04T17:48:04.4703583-05:00</ResultDate2>
        </ExOperationResult>
      </soap:Body>
    </soap:Envelope>


Note the absence of the xmlns=""'s, leaving the inner nodes in the
http://example.com/types namespace.


Using Microsoft's wsdl.exe, running the code under Visual Studio 2010, and
using the same ./test.sh script (and changing the URL used by ./test.sh
appropriately) produces the expected output (where the SOAP response includes
the xmlns=""'s.)


** Further Details about ZIP File Contents **

NOTE   FILE
      |-- ref
 (A)  |   `-- ExampleService.wsdl
      |-- mono
 (B)  |   |-- ExampleService.cs
 (C)  |   |-- ExampleServiceImpl.cs
 (D)  |   |-- ExampleServiceImpl.asmx
      |   |-- build.sh
      |   `-- run.sh
 (E)  |-- microsoft
(B`)  |   |-- ExampleService.cs
(C`)  |   |-- ExampleServiceImpl.cs
(D`)  |   |-- ExampleServiceImpl.asmx
      |   |-- ExampleService.csproj
      |   `-- ExampleService.sln
      `-- test
 (F)      |-- soap-post.xml
         `-- test.sh

(A) - ExampleService.wsdl is the WSDL for the test case web service

(B) - Under ./mono/, ExampleService.cs is the direct output from running:
  $ wsdl -server ExampleService.wsdl
Under ./microsoft/ (B`), it is the same, but having used Microsoft's wsdl.exe
implementation instead of Mono's.

(C) - ExampleServiceImpl.cs contains a class which inherits from the abstract
class generated from wsdl.exe (in ExampleService.cs). The one under ./mono/ (C)
and the one under ./microsoft/ (C`) vary slightly, but only so that the class
definition and method definition share the same CLR attributes as the parent
class in ExampleService.cs (because the generated code in ExampleService.cs
differs slightly in this regard between ./mono/ and ./microsoft/)

(D) ExampleServiceImpl.asmx is a super basic ASMX file that references
ExampleServiceImpl.cs. ExampleServiceImpl.asmx is identical between ./mono/ and
/microsoft/.

(E) ./microsoft/ contains a Visual Studio 2010 Solution that intends to mirror
the source code in ./mono/, which the only difference being that the starting
stub class in ExampleService.cs was generated by a different wsdl.exe
implementation (Mono's versus Microsoft's).

(F) soap-post.xml is the SOAP request that wget sends to the web service when
/test.sh is run.



How often does this happen? 

Always.



Additional Information:


* Program Versions *

** Environment of Ubuntu 10.10 + Mono 2.6.7 (where bug occurs) **

$ cat /etc/issue
Ubuntu 10.10 \n \l

$ uname -a
Linux elm 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 02:41:37 UTC 2010 x86_64
GNU/Linux

$ mono --version
Mono JIT compiler version 2.6.7 (Debian 2.6.7-3ubuntu1)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    GC:            Included Boehm (with typed GC and Parallel Mark)
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none

$ wsdl -? | head -n 2
Web Services Description Language Utility
Mono Framework v2.0.50727.1433

$ xsp2 --version
xsp2.exe 2.6.5.0
(c) (c) 2002-2007 Novell, Inc.
Minimalistic web server for testing System.Web


** Reference Microsoft Environment (where bug does NOT occur) **

Visual Studio 2010 Professional, 10.0.30319.1

Microsoft .NET Framework 4, 4.0.30319

OS Name:  Microsoft® Windows Vista™ Business Version 6.0.6002 Service Pack 2
Build 6002

System Type: X86-based PC (32-bit)

C:\>wsdl /?
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
<//snip//>


** Other **

I originally encountered this error while trying to consume a XSP2 hosted web
service using client-side code generated-by/running-under Apache Axis 1.4.1 In
that environment, an Exception/stack trace is encountered that looks like the
following:

    Exception in thread "main" org.apache.axis2.AxisFault:
org.apache.axis2.databinding.ADBException: Unexpected subelement
xyzElementNameHere
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at com.example.x.y.z.ExampleXYZStub.fromOM(ExampleXYZStub.java:XXX)
        at
com.example.x.y.z.ExampleXYZStub.operationXYZ(ExampleXYZStub.java:XXX)
        at
com.example.abc.WebServiceProxy.makeWebServiceCall(WebServiceProxy.java:XXX)
        at com.example.abc.Test.main(Test.java:XXX)
    Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException:
Unexpected subelement xyzElementNameHere
        at
com.example.x.y.z.types.ExampleXYZResult$Factory.parse(ExampleXYZResult.java:XXX)
        at
com.example.x.y.z.types.ExampleXYZResponse$Factory.parse(ExampleXYZResponsejava:XXX)
        at com.example.x.y.z.ExampleXYZStub.fromOM(ExampleXYZStub.java:XXX)
        ... 3 more
    Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement
xyzElementNameHere
        at
com.example.x.y.z.types.ExampleXYZResult$Factory.parse(ExampleXYZResult.java:XXX)
        ... 5 more

(note: the above stack trace is an obfuscation of the real web service I'm
dealing with; not the example web service included in the test case ZIP file).

In ExampleXYZResult$Factory.parse(), the Axis-generated code is checking if the
element names match, including the namespaces. The local names do match
(whatever "xyzElementNameHere" would happen to be), but because XSP2 doesn't
put the elements back into having no namespace, the namespace portion of the
check fails and the Exception gets thrown.)

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list