You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by b_tho <my...@yahoo.com> on 2007/06/16 01:22:37 UTC

Re: Unexpected subelement

Hi,

I get the "java.lang.RuntimeException: Unexpected subelement" problem too.
Here is my situation.

I have a simple pojo (a transfer object) which is
'com...transferobject.AttachmentDetail'. I have my service class which is
'com...webservices.AttachmentService'. In the service class, I have a
service method declared  as:

   public AttachmentDetail getAttachmentDetail(long attachmentId) {..}

Problem 1: When I deployed my services, the auto generated wsdl put
AttachmentDetail with 'http://transferobject...com.xsd' namespace. 

Next I generated client classes with adb databinding option. 

Then I ran a test using the client classes and checked the response coming
from the getAttachmentDetail using soap monitor. The response xml puts
AttachmentDetail in 'http://webservices...com' namespace.

I kind of figured the difference in the name spaces is causing the
unexpected subelement error on the client.

I am doing something wrong? 

I tried to edit the generated wsdl to make target namespace for
AttachmentDetail type as 'http://webservices....'. This produced unexpected
compilation errors in the generated client classes. 

Problem 2: The autogenerated wsdl puts 'xs:sequence' tags around the
attributes in the AttachmentDetail class. The xml seen through the soap
monitor unfortunately does not have the attributes in the same sequence.
This again causes the same error. I got around this by editing the wsdl to
use xs:all instead. That seems to have solved that problem.

Is there a way I can avoid editing the wsdl? Is there a way I can have xml
generated in sequence or make wsdl use xs:all?

I am newbie and cant find a solution. I would appreciate if anybody can
help. I am just trying to get pojos transferred back and forth to the
client. If anybody has a good other way please let me know.

Thank you!

Bala




Anne Thomas Manes wrote:
> 
> If you know the message structure that the device returns, I suggest
> you modify the WSDL so that it describes the expected result message.
> 
> Anne
> 
> On 5/16/07, Bernhard Breinbauer <e0...@student.tuwien.ac.at> wrote:
>> Hi!
>>
>> I'm having a similar problem as described in the thread: working in .NET,
>> but "Unexpected subelement return" when I try to run as axis2 client
>>
>> My scenario:
>> I have to use a webservice on a proprietary embedded device, therefore i
>> can't
>> change it. Unfortunately the response messages are not composed as
>> described
>> in the wsdl file. One response type in the wsdl has a base type which
>> contains index and name values. The problem ist that the webservice
>> appends
>> them to the end of of the response message instead of to the front.
>> Therefore
>> the sequence of values gets mixed up.
>> My axis2 client bails out when parsing this response message with
>> an "Unexpected subelement" error.
>>
>> I know it is not axis2's fault, but is there a possibility to work around
>> this
>> bug? As mentioned above it is not possible to change the webservice
>> implementation and I don't fancy the option to change the wsdl very much.
>>
>> So does someone has an tip, advice,...?
>>
>> best regards,
>> bernhard
>>
>>
>> PS: I almost forgot: This bug is related to the above mentioned thread
>> because
>> a .Net based client is working. Apparently the .net implementation is
>> more
>> tolerant in this case. (May be a bug in .net :-)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Unexpected-subelement-tf3763248.html#a11149264
Sent from the Axis - User mailing list archive at Nabble.com.


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


Re: Unexpected subelement

Posted by b_tho <my...@yahoo.com>.
Hi,

Thanks for responding. I have tried the nightly build but the problem is
still there. 

I noticed that my autogenerated wsdl is with document style (& use=literal).
Is there a way I can make it use rpc style? I am wondering if that is the
problem. I googled for it but havent had much luck.

Thank you.



Deepal Jayasinghe wrote:
> 
> Hi ,
> First if you can please try with Axis2 nightly builds , or create a JIRA
> and attach your service code.
> 
> Thanks
> Deepal
>> Hi,
>>
>> I get the "java.lang.RuntimeException: Unexpected subelement" problem
>> too.
>> Here is my situation.
>>
>> I have a simple pojo (a transfer object) which is
>> 'com...transferobject.AttachmentDetail'. I have my service class which is
>> 'com...webservices.AttachmentService'. In the service class, I have a
>> service method declared  as:
>>
>>    public AttachmentDetail getAttachmentDetail(long attachmentId) {..}
>>
>> Problem 1: When I deployed my services, the auto generated wsdl put
>> AttachmentDetail with 'http://transferobject...com.xsd' namespace. 
>>
>> Next I generated client classes with adb databinding option. 
>>
>> Then I ran a test using the client classes and checked the response
>> coming
>> from the getAttachmentDetail using soap monitor. The response xml puts
>> AttachmentDetail in 'http://webservices...com' namespace.
>>
>> I kind of figured the difference in the name spaces is causing the
>> unexpected subelement error on the client.
>>
>> I am doing something wrong? 
>>
>> I tried to edit the generated wsdl to make target namespace for
>> AttachmentDetail type as 'http://webservices....'. This produced
>> unexpected
>> compilation errors in the generated client classes. 
>>
>> Problem 2: The autogenerated wsdl puts 'xs:sequence' tags around the
>> attributes in the AttachmentDetail class. The xml seen through the soap
>> monitor unfortunately does not have the attributes in the same sequence.
>> This again causes the same error. I got around this by editing the wsdl
>> to
>> use xs:all instead. That seems to have solved that problem.
>>
>> Is there a way I can avoid editing the wsdl? Is there a way I can have
>> xml
>> generated in sequence or make wsdl use xs:all?
>>
>> I am newbie and cant find a solution. I would appreciate if anybody can
>> help. I am just trying to get pojos transferred back and forth to the
>> client. If anybody has a good other way please let me know.
>>
>> Thank you!
>>
>> Bala
>>
>>
>>
>>
>>   
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Unexpected-subelement-tf3763248.html#a11181100
Sent from the Axis - User mailing list archive at Nabble.com.


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


Re: Unexpected subelement

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi ,
First if you can please try with Axis2 nightly builds , or create a JIRA
and attach your service code.

Thanks
Deepal
> Hi,
>
> I get the "java.lang.RuntimeException: Unexpected subelement" problem too.
> Here is my situation.
>
> I have a simple pojo (a transfer object) which is
> 'com...transferobject.AttachmentDetail'. I have my service class which is
> 'com...webservices.AttachmentService'. In the service class, I have a
> service method declared  as:
>
>    public AttachmentDetail getAttachmentDetail(long attachmentId) {..}
>
> Problem 1: When I deployed my services, the auto generated wsdl put
> AttachmentDetail with 'http://transferobject...com.xsd' namespace. 
>
> Next I generated client classes with adb databinding option. 
>
> Then I ran a test using the client classes and checked the response coming
> from the getAttachmentDetail using soap monitor. The response xml puts
> AttachmentDetail in 'http://webservices...com' namespace.
>
> I kind of figured the difference in the name spaces is causing the
> unexpected subelement error on the client.
>
> I am doing something wrong? 
>
> I tried to edit the generated wsdl to make target namespace for
> AttachmentDetail type as 'http://webservices....'. This produced unexpected
> compilation errors in the generated client classes. 
>
> Problem 2: The autogenerated wsdl puts 'xs:sequence' tags around the
> attributes in the AttachmentDetail class. The xml seen through the soap
> monitor unfortunately does not have the attributes in the same sequence.
> This again causes the same error. I got around this by editing the wsdl to
> use xs:all instead. That seems to have solved that problem.
>
> Is there a way I can avoid editing the wsdl? Is there a way I can have xml
> generated in sequence or make wsdl use xs:all?
>
> I am newbie and cant find a solution. I would appreciate if anybody can
> help. I am just trying to get pojos transferred back and forth to the
> client. If anybody has a good other way please let me know.
>
> Thank you!
>
> Bala
>
>
>
>
>   



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