Hi Jonathan !

Thanks for the test case. I had to modify it a bit, but the issue was sill there. So now it is fixed : see http://svn.apache.org/viewcvs?rev=367116&view=rev for the modified code.

Cheers,
Guillaume Nodet

[EMAIL PROTECTED] wrote:

I have created the attached jUnit test to illustrate the error described in
the original email, SaajMarshalerTest.test_createSOAPMessage:

SaajMarshalerTest.java >>>
/* * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.servicemix.components.saaj; import java.io.ByteArrayInputStream; import java.io.InputStream; import javax.jbi.messaging.NormalizedMessage; import javax.xml.namespace.QName; import javax.xml.soap.MessageFactory; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPMessage; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamSource; import org.servicemix.jbi.jaxp.ResourceSource; import org.servicemix.jbi.jaxp.SourceTransformer; import org.servicemix.jbi.messaging.NormalizedMessageImpl; import org.servicemix.jbi.util.DOMUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.xpath.CachedXPathAPI; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.traversal.NodeIterator; import junit.framework.TestCase; public class SaajMarshalerTest extends TestCase { private static final transient Log log = LogFactory.getLog(SaajMarshalerTest.class); public void testAxis() throws Exception { MessageFactory messageFactory = new org.apache.axis.soap.MessageFactoryImpl(); test_toNMS(messageFactory); } /* public void testAxis2() throws Exception { MessageFactory messageFactory = new org.apache.axis2.saaj.MessageFactoryImpl(); testFactory(messageFactory); } */ public void testSun() throws Exception { MessageFactory messageFactory = new com.sun.xml.messaging.saaj.soap.MessageFactoryImpl(); test_toNMS(messageFactory); } protected void test_toNMS(MessageFactory messageFactory) throws Exception { MimeHeaders headers = new MimeHeaders(); headers.addHeader("Content-Type", "text/xml;"); InputStream is =
getClass().getClassLoader().getResourceAsStream("org/servicemix/components/h
ttp/soap-response.xml"); SOAPMessage sm = messageFactory.createMessage(headers, is); NormalizedMessage nm = new NormalizedMessageImpl(); new SaajMarshaler().toNMS(nm, sm);
       Node node = new SourceTransformer().toDOMNode(new
SourceTransformer().toStreamSource(nm.getContent())); log.debug(new SourceTransformer().toString(node)); CachedXPathAPI cachedXPathAPI = new CachedXPathAPI(); NodeIterator iterator = cachedXPathAPI.selectNodeIterator(node, "//*[local-name() = 'userId']"); Element root = (Element) iterator.nextNode(); QName qname = DOMUtil.createQName(root, root.getAttributeNS("http://www.w3.org/2001/XMLSchema-instance";, "type")); assertEquals("http://www.w3.org/2001/XMLSchema";, qname.getNamespaceURI()); assertEquals("string", qname.getLocalPart()); } public void test_createSOAPMessage() throws Exception { MimeHeaders headers = new MimeHeaders(); headers.addHeader("Content-Type", "text/xml;"); InputStream is =
getClass().getClassLoader().getResourceAsStream("org/servicemix/components/s
aaj/xml-request.xml"); log.debug("Raw XML: " + new SourceTransformer().toString(new StreamSource(is))); is =
getClass().getClassLoader().getResourceAsStream("org/servicemix/components/s
aaj/xml-request.xml"); NormalizedMessage nm = new NormalizedMessageImpl(); nm.setContent(new StreamSource(is)); SOAPMessage msg = new SaajMarshaler().createSOAPMessage(nm); Node node2 = msg.getSOAPBody().getParentNode(); log.debug("Prepared SOAP: " + new SourceTransformer().toString(node2)); CachedXPathAPI cachedXPathAPI = new CachedXPathAPI(); NodeIterator iterator = cachedXPathAPI.selectNodeIterator(node2, "//*[local-name() = 'userId']"); Element root = (Element) iterator.nextNode(); QName qname = DOMUtil.createQName(root, root.getAttributeNS("http://www.w3.org/2001/XMLSchema-instance";, "type")); assertEquals("http://www.w3.org/2001/XMLSchema";, qname.getNamespaceURI()); assertEquals("string", qname.getLocalPart()); } }
xml-request.xml >>>

<?xml version="1.0" encoding="UTF-8"?>

<wn1:getCustomerInfo xmlns:d="http://www.w3.org/2001/XMLSchema";
   xmlns:i="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:wn0="http://systinet.com/xsd/SchemaTypes/";
   xmlns:wn1="http://systinet.com/wsdl/com/cexp/coe/bob/ws/customer/";
   xmlns:wn2="http://systinet.com/soap-jta/";

xmlns:wn3="http://systinet.com/wsdl/com/cexp/coe/bob/services/order/pojo/";>
     <wn1:userId i:type="d:string">akayali</wn1:userId>
   </wn1:getCustomerInfo>



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, January 06, 2006 11:11 AM
To: [email protected]
Subject: RE: [servicemix-user] Problems with JSM flow and SOAP messages


Guillaume,

Now when the SOAP message reaches the SaajComponent, the debug output from the SaajMarshaller.createSOAPMessage() is still missing the "d" namespace,
although the "i" namespace is now included.

Debugging via the TraceComponent reveals that the message from the
HttpSoapConnector has all of the necessary xmlns information, as follows
[2006.01.06]:

TraceComponent.onMessageExchange(67) | Body is: <?xml version="1.0"
encoding="UTF-8"?><wn1:getPerson1
xmlns:wn1="http://systinet.com/wsdl/com/cexp/ws/test/";
xmlns:d="http://www.w3.org/2001/XMLSchema";
xmlns:e="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:i="http://www.w3.org/2001/XMLSchema-instance";
xmlns:wn0="http://systinet.com/soap-jta/";><wn1:key i:type="d:string"
xmlns:wn1="http://systinet.com/wsdl/com/cexp/ws/test/";>PPR,CPY
,20#,92B,LTR,W
E</wn1:key></wn1:getPerson1>

Yesterday, before the changes, the output appeared as follows [20060105]:
TraceComponent.onMessageExchange(67) | Body is: <?xml version="1.0"
encoding="UTF-8"?><wn1:getPerson1
xmlns:wn1="http://systinet.com/wsdl/com/cexp/ws/test/";><wn1:key
type="d:string">PPR,CPY,20#,92B,LTR,WE</wn1:key></wn1:getPerson1>


As you can see, the changes to the HttpInOutBinding were effective, but somewhere in the Saaj layer, the xmlns information is getting stripped.

Looking at logs from 2006.01.05 reveal that with the older
Xfire-all-20051222.jar and older HttpSoapInOutBinding, the SOAP message
create by the SaajMarshaler looks like this [2006.01.05]:

SaajMarshaler.createSOAPMessage(137) | <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";><SO
AP-ENV:Header/
<SOAP-ENV:Body><wn1:getPerson1
xmlns:wn1="http://systinet.com/wsdl/com/cexp/ws/test/";><wn1:key
type="d:string">PPR,CPY,20#,92B,LTR,WE</wn1:key></wn1:getPerso
n1></SOAP-ENV:
Body></SOAP-ENV:Envelope>

With the new xfire-all-20060106.jar and new HttpSoapInOutBinding in place, the output looks like this [2006.01.06]:
SaajMarshaler.createSOAPMessage(137) | <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";><SO
AP-ENV:Header/
<SOAP-ENV:Body><wn1:getPerson1
xmlns:wn1="http://systinet.com/wsdl/com/cexp/ws/test/";><wn1:key
xmlns:i="http://www.w3.org/2001/XMLSchema-instance";
i:type="d:string">PPR,CPY,20#,92B,LTR,WE</wn1:key></wn1:getPer
son1></SOAP-EN
V:Body></SOAP-ENV:Envelope>

You can see that the latest version now includes the "i" namespace, but no mention of ths "d" namespace. This is actually worse than the situation we were in yesterday, as namespace errors are now thrown by the receiving SOAP stack. I'm not sure what the issue is here, but it seems to be the interplay
between the SaajMarshaler and the new Xfire libraries.

/jonathan

-----Original Message-----
From: Guillaume Nodet [mailto:[EMAIL PROTECTED]
Sent: Friday, January 06, 2006 2:47 AM
To: [email protected]
Subject: Re: [servicemix-user] Problems with JSM flow and SOAP messages


Done.
Get the latest version of HttpSoapInOutBinding and be sure to grab
the latest xfire snapshot : http://dist.codehaus.org/servicemix/jars/xfire-all-1.0-20060106.jar.

Cheers,
Guillaume Nodet

[EMAIL PROTECTED] wrote:

Guillaume,

One more thing: Can you verify that the HttpInOutBinding
(and related
components) is properly capturing all of the namespaces when
stripping the
SOAP-ENV? It seems like the inbound request messages are
missing the "d"
namespace. The SaajMarshaller is ok.

/jonathan



-----Original Message-----
From: Guillaume Nodet [mailto:[EMAIL PROTECTED]
Sent: Friday, December 30, 2005 1:42 AM
To: [email protected]
Subject: Re: [servicemix-user] Problems with JSM flow and SOAP messages


This seems strange, as my test case fails with the old
SaajMarshaler
code, and works with the new one.
I changed, but i was quite sure it was working before, as
you said.
It may be related to class loader issues, if the library
used are not
the same : we recently changed
to maven 2, so that the order of included jars ma be
different. I'll
try to investigate it.

Guillaume

[EMAIL PROTECTED] wrote:

Guillaume,

If I use only the modified HttpInOutBinding, and the older
SaajMarshaller
(with the org.w3c.dom.Attr import), everything works
properly. This leads me
to believe that there is an issue with the latest changes to the
SaajMarshaller.

/jonathan



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Thursday, December 29, 2005 7:44 PM
To: [email protected]
Subject: RE: [servicemix-user] Problems with JSM flow and SOAP messages


I rebuilt using the full files from Apache-HEAD, but get the same namespace issues; no "d". I am trying to narrow down the problem on my end. Should I use all of the latest components in http and saaj?
/jonathan

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Thursday, December 29, 2005 6:53 PM
To: [email protected]
Subject: RE: [servicemix-user] Problems with JSM flow and SOAP messages


This is for a slightly different service, but the basic
problem is
illustrated. Your example has the "d" xmlns, but my result does not. On further review, my source classes were slightly out of date with yours. I will try again tomorrow morning using the straight java
files from the
Apache-HEAD (with package corrections), and let you know if
the issue
persists.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
 xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> <soap:Body>
     <wn2:getPersonResponse
xmlns:wn2="http://systinet.com/wsdl/com/cexp/ws/test/";>
         <wn2:response i:type="wn2:Person"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance";
xmlns:wn2="http://systinet.com/wsdl/com/cexp/ws/test/";>
             <wn2:description i:type="d:string"

xmlns:wn2="http://systinet.com/wsdl/com/cexp/ws/test/";>Desktop
customizer
(1135883476645)</wn2:description>
             <wn2:firstName i:type="d:string"
xmlns:wn2="http://systinet.com/wsdl/com/cexp/ws/test/";>Jonatha
n</wn2:firstNa
me>
             <wn2:lastName i:type="d:string"
xmlns:wn2="http://systinet.com/wsdl/com/cexp/ws/test/";>Edwards
</wn2:lastName
         </wn2:response>
     </wn2:getPersonResponse>
 </soap:Body>
</soap:Envelope>
-----Original Message-----
From: Guillaume Nodet [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 29, 2005 1:16 PM
To: [email protected]
Subject: Re: [servicemix-user] Problems with JSM flow and SOAP messages


I have a test case which is the same as yours (or should be)
and the result I have is the following :

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<soap:Body>
<wn1:getCustomerInfo
xmlns:d="http://www.w3.org/2001/XMLSchema";
   xmlns:e="http://schemas.xmlsoap.org/soap/envelope/";
   xmlns:i="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:wn0="http://systinet.com/xsd/SchemaTypes/";
xmlns:wn1="http://systinet.com/wsdl/com/cexp/coe/bob/ws/
customer/"
xmlns:wn2="http://systinet.com/soap-jta/"; xmlns:wn3="http://systinet.com/wsdl/com/cexp/coe/bob/services/
order/pojo/">
<wn1:userId i:type="d:string" xmlns:wn1="http://systinet.com/wsdl/com/cexp/coe/bob/ws/custom
er/">akayali</wn1:userId>
 </wn1:getCustomerInfo>
</soap:Body>
</soap:Envelope>

This one seems good.
What is the exact result you have ?

Cheers,
Guillaume Nodet

[EMAIL PROTECTED] wrote:

Guillaume,

After applying the changes that you sent me in the diff
links the JMS flow
now returns the full SOAP body. However, the SOAP messages
are now missing
the "i" and "d" namespaces that you had worked on fixing
last week.
/jonathan



-----Original Message-----
From: Guillaume Nodet
[mailto:[EMAIL PROTECTED]
Sent: Thursday, December 29, 2005 2:51 AM
To: [email protected]
Subject: Re: [servicemix-user] Problems with JSM flow and SOAP messages


You can grab the new versions of SaajMarshaler and HttpSoapInOutBinding.
The problem should be fixed now.

Here are the diffs you should report to your sources (the package have been renamed) *
http://svn.apache.org/viewcvs.cgi/incubator/servicemix/trunk/s
ervicemix-components/src/main/java/org/apache/servicemix/compo
nents/http/HttpSoapInOutBinding.java?rev=359186&r1=359767&r2=3
59186&diff_format=h
*
http://svn.apache.org/viewcvs.cgi/incubator/servicemix/trunk/s
ervicemix-components/src/main/java/org/apache/servicemix/compo
nents/saaj/SaajMarshaler.java?rev=359186&r1=359767&r2=359186&d
iff_format=h

Cheers,
Guillaume Nodet

[EMAIL PROTECTED] wrote:



Two steps forward, one step back, or so it seems.

The jmsFlow seems to be broken - at least in my
custom build
of ServiceMix.


The version of the codebase that I am using is 1055, with
"servicemix/components/http/*" and
"servicemix/components/saaj/*" from the


Apache-HEAD. In addition, I am using the
xfire-all-1.0-20051222.jar. This is


happening using the Sun Java 5 JVM for both ActiveMQ 3.2.1
and ServiceMix.


With this build, the SEDA flow works properly, and the
client gets the


response from the invoked SOAP service (SOAP client ->
HttpSoapClient ->


SaajComponent -> SOAP service). When I change the flow to
JMS, using
ActiveMQ 3.2.1 with the "reliable" connect string, my
client throws a
NullPointerException. This is because the SOAP-Body in the
response is


completely empty. I have verified that the body is
populated
correclty by


the SaajComponent (visible in the DEBUG output in log4j),
but the actual


HttpResponse from the HttpSoapConnector has an empty
SOAP-Body. As this


problem only presents itself using the JMS flow, and only
surfaced after


using the newer classes and library, I am fairly certain
that these events


are all highly correlated, but I am not sure what the root
cause is. I need


the new classes, and the newer xfire library in
order for my
services to


call successfully under SEDA, and cannot revert.

regards,
/jonathan



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 28, 2005 9:53 AM
To: [email protected]
Subject: RE: [servicemix-user] Problems invoking a web service with SOAP


Guillaume,

Installing the new Xfire library did the trick: The XML returned from the SaajComponent is well formed, and the HttpSoapConnector
handles the
Http+SOAP calls properly. Thanks to everyone who
helped me
to get Soap


communication working, especially Guillaume :-)

Now I'm off to wrestle with the IBM Java 5 JVM
(beta) on AIX.
best wishes for the holidays,
/jonathan








Reply via email to