I apologize for not replying but I was unavailable over the weekend.
I didn't know the answer, anyway :)
Well done, you found it!
Thanks Huitang for posting the solution for others to find in the
future.
Regards,
-jeff
 

-----Original Message-----
From: Huitang Li [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 08, 2007 4:02 AM
To: [email protected]
Subject: Re: org.xml.sax.SAXParseException: The prefix "ns1" for element
"ns1:modifyMe" is not bound.

Finally found the root cause of the problem after debugging with the 
resin source code ....

It is caused by the fact that Axis2 generated stub class cannot work 
well with resin 3. In resin environment, resin-implemented 
xml.stream.XMLStreamWriter class is used to generate soap message. So, 
in order to work with the resin implementation, the setPrefix() method 
call in serialize() of the stub code must be before writeNamespace() 
method call. Actually, with resin implemention, the setPrefix() method 
call is redundant.

Thanks for all who have contributed your insight, especially Jeff.




Huitang Li wrote:
> I tested with a public accessible web service, and it has the same 
> result. If you want to test it out, please see the web service 
> http://www.tilisoft.com/ws/LocInfo/ZipCode.asmx
> You can get its wsdl here: 
> http://www.tilisoft.com/ws/LocInfo/ZipCode.asmx?WSDL
> Follow the steps of Axis2 1.3 to generate axis adb client and then 
> test the generated stub code.
>
> It runs ok if the code is not run in resin environment.
> The soap message incorrectly created in resin environment is:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
> <soapenv:Body
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
> <ns1:GetDistance>                                             <==  the

> namespace is missing when the code is run with resin in non-debugging 
> mode.
> ...
> </soapenv:Body>
> </soapenv:Envelope>
>
> The soap message correctly created in resin remote-debugging or when 
> the resin is not involved:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
> <soapenv:Body
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
> <ns1:GetDistance 
> xmlns:ns1="http://www.tilisoft.com/ws/LocInfo/literalTypes";>    <== 
> The namespace is correctly put there in remote-debugging resin or 
> non-resin environments.
> ...
> </soapenv:Body>
> </soapenv:Envelope>
>
> So, my question is: how can the soap message be created correctly in 
> resin remote-debugging mode while it is incorrectly created when resin

> is not running in remote-debugging mode?  It looks more like a 
> resin-users question. I posted this question to that user-group 
> mailing list as well. If you want to test it, please download resin 
> 3.1.2.    I use jdk 1.5.0_10.
>
> Thanks.
>
>
>
>
> Huitang Li wrote:
>> Thanks for your very resourceful reply. Sorry again that I cannot 
>> post the wsdl file here for security reasons.
>>
>> I think you made a very good point that the soap engine is probably 
>> different in resin. I asked the same question on resin-users, and no 
>> one answers it, unfortunately.
>>
>> The soap message incorrectly created in resin environment is:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <soapenv:Envelope 
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>> <soapenv:Body
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>> <ns2:requestMe>
>> <ns2:bb>safadfasf</ns2:bb>
>> <ns2:aa>asdfasf</ns2:aa>
>> </ns2:requestMe>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>> The soap message correctly created in resin remote-debugging and test

>> cases is:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <soapenv:Envelope 
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>> <soapenv:Body
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>> <ns2:requestMe xmlns:ns2="http://test.mytest.com";>    
>> <===============Note  the very difference here.
>> <ns2:bb>safadfasf</ns2:bb>
>> <ns2:aa>asdfasf</ns2:aa>
>> </ns2:requestMe>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>>
>> I did a little research on it. It looks like the 
>> XMLOutputFactory.javax.xml.stream.isRepairingNamespaces setting to 
>> true or false will cause this difference. I am not an expert on this,

>> so probably I am misleading you. If you have this experience about in

>> which circumstances this parameter should be set, please let me 
>> know.  Maybe I need to set this parameter? But how to set it in the 
>> stub? I cannot find it anywhere in the stub.
>>
>>
>> Thanks.
>>
>>
>>
>>
>> Walker, Jeff wrote:
>>> Martin's right. Without wsdl, there is little we can do to help.
>>> The symptoms you describe are strange. Below you mention different
>>> behavior when debugging. I have only seen that when a multi-threaded

>>> app
>>> runs differently in debug mode vs non-debug mode.
>>>
>>> Namespace attribute appearing in one version of client's soap
message
>>> but not in another, is very strange. I have no answer, but suggest
that
>>> the client on the server is actually using a soap specific engine
from
>>> Resin, but what is the soap engine is the client is using when
running
>>> in non-server environment? They seem to be different, hence
different
>>> request msgs generated?
>>>
>>> By the way, I have seen before where the namespace is removed out of
>>> each start tag and placed at the beginning of a soap msg. Can you
check
>>> if xmlns:ns1="http://test.mytest.com"; is declared in another part of

>>> the
>>> soap message? I think a soap engine is allowed to do this and still 
>>> have
>>> a valid message. (I have seen this with SOAPScope).
>>>
>>> We need the wsdl to know for sure. That would allow a 2nd person to
>>> create a client/service and see what request msgs get generated from

>>> it.
>>> (It would clear up whether it's a problem just for you and your
>>> environment, or a wsdl-based problem).
>>> Regards,
>>> -jeff
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Huitang Li [mailto:[EMAIL PROTECTED] Sent: 
>>> Friday, October 05, 2007 5:32 PM
>>> To: [email protected]
>>> Subject: Re: org.xml.sax.SAXParseException: The prefix "ns1" for 
>>> element
>>> "ns1:modifyMe" is not bound.
>>>
>>> Sorry for the confusion. But all "ns2" should be "ns1".
>>>
>>> Huitang Li wrote:
>>>  
>>>> With further debugging, I notice that somehow the soap message is 
>>>> NOT created correctly when the client code is running in server
>>>>     
>>> environment.
>>>  
>>>> <ns1:requestMe> <ns1:E1>...</ns1:E1> </ns1:requestMe>
>>>>
>>>> However, when it is running in debug mode or non-server 
>>>> environment, the soap message is created correctly with the 
>>>> namespace defined.
>>>> <ns2:requestMe
xmlns:ns2="http://test.mytest.com";><ns1:E1>...</ns1:E1>
>>>>     
>>>
>>>  
>>>> </ns2:requestMe>
>>>>
>>>> Again, the client code is Axis generated based on  a wsdl file.
>>>>
>>>> Any idea?
>>>>
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>>
>>>> Martin Gainty wrote:
>>>>   
>>>>> Without seeing the wsdl there is very little we can do to help you
>>>>>
>>>>> (Nonetheless I would check Classpath delta)
>>>>>
>>>>> M--
>>>>> ----- Original Message -----
>>>>> From: "Huitang Li" <[EMAIL PROTECTED]>
>>>>> To: <[email protected]>
>>>>> Sent: Thursday, October 04, 2007 6:08 PM
>>>>> Subject: Re: org.xml.sax.SAXParseException: The prefix "ns1" for
>>>>>       
>>> element
>>>  
>>>>> "ns1:modifyMe" is not bound.
>>>>>
>>>>>
>>>>>  
>>>>>     
>>>>>> Thanks, Jeff.  Sorry that I cannot post the wsdl here since it is
a
>>>>>> component of a secure site.
>>>>>>
>>>>>> What confuses me is that the exception is not thrown when I put a
>>>>>> breakpoint in that line in the debug mode.
>>>>>> Also, when it is run in test cases (without having it run in
server
>>>>>> environment), the exception is not thrown. However, when it is
run
>>>>>>         
>>> in
>>>  
>>>>>> server environment (I am using resin 3.1.2), the exception shows
up.
>>>>>>
>>>>>> I used the axis2-generated client stub.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Walker, Jeff wrote:
>>>>>>          
>>>>>>> Huitang,
>>>>>>> I suggest you email the mailing list your wsdl and schema for 
>>>>>>> people to
>>>>>>> see. If ns1 prefix is not bound, then it might be a relatively
>>>>>>>           
>>> simply
>>>  
>>>>>>> namespace fix. Let's hope so.
>>>>>>> -jeff
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Huitang Li [mailto:[EMAIL PROTECTED]
>>>>>>> Sent: Thursday, October 04, 2007 2:46 PM
>>>>>>> To: [email protected]
>>>>>>> Subject: Re: org.xml.sax.SAXParseException: The prefix "ns1" for

>>>>>>> element
>>>>>>> "ns1:modifyMe" is not bound.
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I did not see any input for my question. Maybe it is a too
simple
>>>>>>>           
>>> and
>>>  
>>>>>>> dumb question to answer? Is it only me who gets this exception?
>>>>>>>
>>>>>>> Experts, please help me out.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Huitang Li wrote:
>>>>>>>
>>>>>>>              
>>>>>>>> Here is more information about the exception: when the code is 
>>>>>>>> running
>>>>>>>>
>>>>>>>>                     
>>>>>>>              
>>>>>>>> in debug mode and I put a breakpoint on the line
>>>>>>>> "_operationClient.execute(true);", this line will not throw 
>>>>>>>> exception.
>>>>>>>>
>>>>>>>>                     
>>>>>>>              
>>>>>>>> However, this line will throw the exception when the app is not
>>>>>>>> running in debug mode.
>>>>>>>>
>>>>>>>> I did google search, and found quite a few postings mentioning
the
>>>>>>>> same problem. However, I did not find any solution posted. If 
>>>>>>>> you know
>>>>>>>>
>>>>>>>>                     
>>>>>>>              
>>>>>>>> the solution, please let me know.
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Huitang Li wrote:
>>>>>>>>
>>>>>>>>                  
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I created a web service client with Axis2. When I ran it, I
got
>>>>>>>>>               
>>> the
>>>  
>>>>>>>>> exception. This exception is thrown by the axis-genenated stub
>>>>>>>>>               
>>> code.
>>>  
>>>>>>>>> org.apache.axis2.AxisFault: org.xml.sax.SAXParseException: The

>>>>>>>>> prefix
>>>>>>>>>
>>>>>>>>>                         
>>>>>>>              
>>>>>>>>> "ns1" for element "ns1:modifyUser" is not bound.
>>>>>>>>>    at
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                         
>>>
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java

>>>
>>>
>>>  
>>>>>>> :486)
>>>>>>>
>>>>>>>              
>>>>>>>>>    at
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                         
>>>
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(Out

>>>
>>>
>>>  
>>>>>>> InAxisOperation.java:343)
>>>>>>>
>>>>>>>              
>>>>>>>>>    at
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                         
>>>
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper

>>>
>>>
>>>  
>>>>>>> ation.java:389)
>>>>>>>
>>>>>>>              
>>>>>>>>>    at
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                         
>>>
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInA

>>>
>>>
>>>  
>>>>>>> xisOperation.java:211)
>>>>>>>
>>>>>>>              
>>>>>>>>>    at
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                         
>>>
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163

>>>
>>>
>>>  
>>>>>>> )
>>>>>>>
>>>>>>>              
>>>>>>>>>  ....
>>>>>>>>>
>>>>>>>>> Any solution?
>>>>>>>>>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>               
>>>
--------------------------------------------------------------------- 
>>>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                         
>>>
---------------------------------------------------------------------
>>>  
>>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>>>
>>>>>>>>
>>>>>>>>                     
>>>
---------------------------------------------------------------------
>>>  
>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>           
>>>
---------------------------------------------------------------------
>>>  
>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>>
>>>>>>>
>>>>>>>                 
>>>
---------------------------------------------------------------------
>>>  
>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>
>>>>>>
>>>>>>             
>>>>>
---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>         
>>>>
---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>     
>>>
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>   
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to