[jbosstools-issues] [JBoss JIRA] Issue Comment Edited: (JBDS-1602) Web Service Tester generates SOAP bodies that cause marshaling issues
Lukas Jungmann (JIRA)
jira-events at lists.jboss.org
Tue Apr 12 15:09:33 EDT 2011
[ https://issues.jboss.org/browse/JBDS-1602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595074#comment-12595074 ]
Lukas Jungmann edited comment on JBDS-1602 at 4/12/11 3:09 PM:
---------------------------------------------------------------
The problem here is that tester does not handle XML schema's elementFormDefault attribute correctly.
Currently it generates:
...
<soap:Body>
<getStockQuoteBySymbol xmlns = "http://www.jboss.com/webservices/StockQuoteService">
<arg0>?</arg0>
</getStockQuoteBySymbol>
</soap:Body>
...
which is wrong since according to xml namespace inheritance rules - if I understand them correctly - arg0 element belongs to "http://www.jboss.com/webservices/StockQuoteService" namespace whereas in xml schema, there is defined that it should be in default/no namespace (some ws-stacks with disabled(?) xml message validation can handle this)
For elementFormDefault="unqualified" (default value) the generated message should be:
...
<soap:Body>
<ns1:getStockQuoteBySymbol xmlns:ns1 = "http://www.jboss.com/webservices/StockQuoteService">
<arg0>?</arg0>
</ns1:getStockQuoteBySymbol>
</soap:Body>
...
and for elementFormDefault="qualified" it should be:
...
<soap:Body>
<ns1:getStockQuoteBySymbol xmlns:ns1 = "http://www.jboss.com/webservices/StockQuoteService">
<ns1:arg0>?</ns1:arg0>
</ns1:getStockQuoteBySymbol>
</soap:Body>
...
I attached a patch which should fix this issue for WSDL files I have around (contains also a fix for test, which needs to be applied).
There are still these TODO's:
1) I did not touch code where I can not get (in the other words only code I know I can reach was fixed - code coverage was used to find such code)
2) it may happen that message contains elements from more than one namespace - attached patch assumes that there's only one namespace (test case is needed for fixing this)
3) usage of XML Schema's attributeFormDefault attribute may cause similar issue - attached patch does not take this into account
was (Author: jlukas):
The problem here is that tester does not handle XML schema's elementFormDefault attribute correctly.
Currently it generates:
...
<soap:Body>
<getStockQuoteBySymbol xmlns = "http://www.jboss.com/webservices/StockQuoteService">
<arg0>?</arg0>
</getStockQuoteBySymbol>
</soap:Body>
...
which is wrong since according to xml namespace inheritance rules arg0 element belongs to "http://www.jboss.com/webservices/StockQuoteService" namespace whereas in xml schema, there is defined that it should be in default/no namespace (some ws-stacks with disabled(?) xml message validation can handle this)
For elementFormDefault="unqualified" (default value) the generated message should be:
...
<soap:Body>
<ns1:getStockQuoteBySymbol xmlns:ns1 = "http://www.jboss.com/webservices/StockQuoteService">
<arg0>?</arg0>
</ns1:getStockQuoteBySymbol>
</soap:Body>
...
and for elementFormDefault="qualified" it should be:
...
<soap:Body>
<ns1:getStockQuoteBySymbol xmlns:ns1 = "http://www.jboss.com/webservices/StockQuoteService">
<ns1:arg0>?</ns1:arg0>
</ns1:getStockQuoteBySymbol>
</soap:Body>
...
I attached a patch which should fix this issue for WSDL files I have around (contains also a fix for test, which needs to be applied).
There are still these TODO's:
1) I did not touch code where I can not get (in the other words only code I know I can reach was fixed - code coverage was used to find such code)
2) it may happen that message contains elements from more than one namespace - attached patch assumes that there's only one namespace (test case is needed for fixing this)
3) usage of XML Schema's attributeFormDefault attribute may cause similar issue - attached patch does not take this into account
> Web Service Tester generates SOAP bodies that cause marshaling issues
> ---------------------------------------------------------------------
>
> Key: JBDS-1602
> URL: https://issues.jboss.org/browse/JBDS-1602
> Project: Developer Studio (JBoss Developer Studio)
> Issue Type: Bug
> Affects Versions: 4.0.0.GA
> Environment: JBoss Developer Studio 4.0.0 on Mac OS X 10.6.6
> Reporter: Bill Meyer
> Assignee: Brian Fitzpatrick
> Fix For: 4.1.0.GA
>
> Attachments: jbds-1602-partial.patch, Jira - JBDS-1602.zip
>
> Original Estimate: 0 minutes
> Remaining Estimate: 0 minutes
>
> Open JBDS 4, go to Window -> Show View -> Other -> Web Service Tester.
> If I enter my WSDL and select the appropriate Service, Port, and Operation (there's only 1), the SOAP Body gets filled in as:
> <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
> <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>
> <getStockQuoteBySymbol xmlns = "http://www.jboss.com/webservices/StockQuoteService">
> <arg0>?</arg0>
> </getStockQuoteBySymbol>
> </soap:Body>
> </soap:Envelope>
> which seems to cause the operation invocation to choke with a NullPointerException. It appears to be a problem with unmarshalling on the Web Service side. Interesting note is that soapUI causes the same behavior when I copy the above SOAP envelope into soapUI and execute the call.
> If I change the SOAP envelope by moving the operation namespace to the top of the XML body:
> <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
> <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"
> xmlns:stoc = "http://www.jboss.com/webservices/StockQuoteService" >
> <soap:Body>
> <stoc:getStockQuoteBySymbol>
> <arg0>?</arg0>
> </stoc:getStockQuoteBySymbol>
> </soap:Body>
> </soap:Envelope>
> Everything executes perfectly. So, I am assuming that the Web Service Tester is generating a SOAP Body that results in a failed web service invocation. I've tried this with a few different web services (String and float args) and they all fail the same.
> I am trying to invoke a JAX-WS based web service. I have tried an ASMX-based web service up on webservicex.net (http://www.webservicex.net/stockquote.asmx?WSDL) and not had the same issue.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbosstools-issues
mailing list