ws-muse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vinh Nguyen (JIRA)" <j...@apache.org>
Subject [jira] Created: (MUSE-155) xml element capability result improperly changed when passed to the client (namespace and prefix not preserved)
Date Thu, 30 Nov 2006 02:57:21 GMT
xml element capability result improperly changed when passed to the client (namespace and prefix
not preserved)
---------------------------------------------------------------------------------------------------------------

                 Key: MUSE-155
                 URL: http://issues.apache.org/jira/browse/MUSE-155
             Project: Muse
          Issue Type: Bug
    Affects Versions: 2.0.0
         Environment: Muse 2.0.0, Axis2 1.0, Apache 2.2.3, Tomcat 5.5.17, JDK 1.5.0_08, Windows
XP SP2
            Reporter: Vinh Nguyen
         Assigned To: Dan Jemiolo


Muse is improperly changing the xml result of operations that return custom types.

For example, my code returns a custom <Box> type in an xml Element.  On the pass back
to the client, Muse wraps the Element in a response wrapper.  In doing so, it improperly changes/deletes
my element's namespace and prefix.  This causes problems on the client side when I try to
extract out my element and deserialize back to a javabean.  The original namespace was moved/deleted
and a default one was inserted, so it becomes difficult to extract the original element, and
my code encounters errors due to mismatched namespaces.

Here's my server code:
    public Element boxOperation(int width) throws Exception
    {
        BoxDocument doc = BoxDocument.Factory.newInstance();
        BoxType type = doc.addNewBox();
        type.setWidth(BigInteger.valueOf(width));
        type.setHeight(BigInteger.valueOf(width));

        Element response = XmlUtils.getFirstElement(doc.newDomNode());
        System.out.println("--BoxCapability toString(response):\n" + XmlUtils.toString(response));
        return response;
    }

Here's the server log output:
    --BoxCapability toString(response):
    <?xml version="1.0" encoding="UTF-8"?>
    <box:Box xmlns:box="http://cisco.com/musebox/schemas/box">
        <box:width>555</box:width>
        <box:height>555</box:height>
    </box:Box>

On the client side, here's the SOAP trace of the incoming data:
    [CLIENT TRACE] SOAP envelope contents (incoming):
    ...
        <soapenv:Body>
            <muse-op:BoxOperationResponse
                xmlns:muse-op="http://cisco.com/musebox/simple/box" xmlns:tns="http://ws.apache.org/axis2">
                <Box xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:box="http://cisco.com/musebox/schemas/box">
                    <box:width>555</box:width>
                    <box:height>555</box:height>
                </Box>
            </muse-op:BoxOperationResponse>
        </soapenv:Body>
    </soapenv:Envelope>

If I modify my wsdl and remove one attribute line
(xmlns="http://schemas.xmlsoap.org/wsdl/") at the top of the file, I get the following client
side SOAP trace instead:
    [CLIENT TRACE] SOAP envelope contents (incoming):
    ...
    <soapenv:Body>
            <muse-op:BoxOperationResponse
                xmlns:muse-op="http://cisco.com/musebox/simple/box" xmlns:tns="http://ws.apache.org/axis2">
                <Box xmlns:box="http://cisco.com/musebox/schemas/box">
                    <box:width>555</box:width>
                    <box:height>555</box:height>
                </Box>
            </muse-op:BoxOperationResponse>
        </soapenv:Body>
    </soapenv:Envelope>

NOTE: The difference between the two traces are the namespaces in the <Box> element.

If my client code calls XmlUtils.toString(XmlUtils.getFirstElement(response)), I get:
    <?xml version="1.0" encoding="UTF-8"?>
    <Box xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:box="http://cisco.com/musebox/schemas/box">
        <box:width>555</box:width>
        <box:height>555</box:height>
    </Box>

So there are 2 problems here:

1) Muse takes my operation output and puts on a response wrapper.  In doing so, it removes
both the namespace and prefix of the <Box> element.
After removing the wrapper, the <Box> element now becomes useless because it has no
namespace, even though namespaces for child elements are properly preserved.  This is why
my client code is running into errors when trying to serialize the xml element back into a
javabean (XmlBean object).  It tries to find/match the original namespace of the <Box>
element, but it is nowhere to be found.

2) In addition to Muse removing the top element's namespace, it tries to put in a default
one instead.  If my wsdl file contains the attribute
xmlns="http://schemas.xmlsoap.org/wsdl/"
(which is defined in the samples), then Muse will take this namespace and set it as the default
in the <Box> element.  So my client code complains of a namespace mismatch.  (The namespace
xmlns:tns="http://ws.apache.org/axis2" is also inserted either by Muse or Axis2, but it isn't
causing problems at this moment.)

So I think Muse should either properly preserve the xml operation results exactly as is, or
put in the correct element namespaces and not override incorrectly.  Muse does preserve notification
outputs correctly, but it doesn't seem to do so for operations.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


Mime
View raw message