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 Jason Wells <ja...@wells.me> on 2009/01/07 00:13:58 UTC

Returning from a different package

Hi, I'm new to the Axis2/SOAP world and I'm using Tomcat 6/Axis2  
1.4.1. I'm running into a problem. I've written a simple Java POJO  
service and generated ADB client code from its generated WSDL. One of  
its operations returns another simple POJO, in this case having two  
String members. When I call it from a SOAP tool I'm using, I get this  
response back:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ 
"
	<soapenv:Body>
		<ns:getClass1Response xmlns:ns="http://service.enterprise.semantica">
			<ns:return type="semantica.enterprise.model.Concept">
				<ax21:name>Blah<./ax21:name>
				<ax21:guid>Blah2.</ax21:guid>
			</ns:return>
		</ns:getClass1Response>
	</soapenv:Body>
</soapenv:Envelope>

And when I call that operation from my ADB client, I get the following  
exception:

"org.apache.axis2.AxisFault:  
org.apache.axis2.databinding.ADBException: Unexpected subelement guid"

But I have another operation that is essentially identical, in that it  
has the same signature and returns a different POJO having two  
Strings, just like the first one. I get this back:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ 
">
	<soapenv:Body>
		<ns:getZogResponse xmlns:ns="http://service.enterprise.semantica">
			<ns:return type="semantica.enterprise.service.Zog">
				<ax23:one>One.</ax23:one>
				<ax23:theOther>The Other.</ax23:theOther>
			</ns:return>
		</ns:getZogResponse>
	</soapenv:Body>
</soapenv:Envelope>

This one works in the ADB client. The only significant difference I  
see is that the QNames for the return classes is different (ax21 vs.  
ax23). The two classes are basically identical, except that the broken  
code uses a class from a different package than the service class, and  
the working class is in the same package. But why would this be a  
problem?

Thanks,
Jason

Re: Returning from a different package

Posted by Jason Wells <ja...@wells.me>.
Here it is. The relevant operation is getConcept.


Re: Returning from a different package

Posted by Jason Wells <ja...@wells.me>.
The class returned by the first operation, the one that threw the  
exception (below), was a subclass of an abstract class. The exception  
went away once I changed that. I'm glad it works now, but why would  
this be a problem?


On Jan 6, 2009, at 6:14 PM, Deepal Jayasinghe wrote:

> Hi,
>
> It is not the QName different in those two cases, it is just the  
> prefix.
> It does not matter what the prefix is. What you need to do is too
> compare the response with the WSDL. Since you are new the Web service,
> one thing you can do is send us the WSDL, then we can tell what the
> problem is.
>
> Deepal
>
> Jason Wells wrote:
>> Hi, I'm new to the Axis2/SOAP world and I'm using Tomcat 6/Axis2
>> 1.4.1. I'm running into a problem. I've written a simple Java POJO
>> service and generated ADB client code from its generated WSDL. One of
>> its operations returns another simple POJO, in this case having two
>> String members. When I call it from a SOAP tool I'm using, I get this
>> response back:
>>
>> <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>> <soapenv:Body>
>> <ns:getClass1Response xmlns:ns="http://service.enterprise.semantica
>> <http://service.enterprise.semantica/>">
>> <ns:return type="semantica.enterprise.model.Concept">
>> <ax21:name>Blah<./ax21:name>
>> <ax21:guid>Blah2.</ax21:guid>
>> </ns:return>
>> </ns:getClass1Response>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>> And when I call that operation from my ADB client, I get the  
>> following
>> exception:
>>
>> "org.apache.axis2.AxisFault:
>> org.apache.axis2.databinding.ADBException: Unexpected subelement  
>> guid"
>>
>> But I have another operation that is essentially identical, in that  
>> it
>> has the same signature and returns a different POJO having two
>> Strings, just like the first one. I get this back:
>>
>> <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>> <soapenv:Body>
>> <ns:getZogResponse xmlns:ns="http://service.enterprise.semantica
>> <http://service.enterprise.semantica/>">
>> <ns:return type="semantica.enterprise.service.Zog">
>> <ax23:one>One.</ax23:one>
>> <ax23:theOther>The Other.</ax23:theOther>
>> </ns:return>
>> </ns:getZogResponse>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>> This one works in the ADB client. The only significant difference I
>> see is that the QNames for the return classes is different (ax21 vs.
>> ax23). The two classes are basically identical, except that the  
>> broken
>> code uses a class from a different package than the service class,  
>> and
>> the working class is in the same package. But why would this be a  
>> problem?
>>
>> Thanks,
>> Jason
>
> -- 
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>


Re: Returning from a different package

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi,

It is not the QName different in those two cases, it is just the prefix.
It does not matter what the prefix is. What you need to do is too
compare the response with the WSDL. Since you are new the Web service,
one thing you can do is send us the WSDL, then we can tell what the
problem is.

Deepal

Jason Wells wrote:
> Hi, I'm new to the Axis2/SOAP world and I'm using Tomcat 6/Axis2
> 1.4.1. I'm running into a problem. I've written a simple Java POJO
> service and generated ADB client code from its generated WSDL. One of
> its operations returns another simple POJO, in this case having two
> String members. When I call it from a SOAP tool I'm using, I get this
> response back:
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> <soapenv:Body>
> <ns:getClass1Response xmlns:ns="http://service.enterprise.semantica
> <http://service.enterprise.semantica/>">
> <ns:return type="semantica.enterprise.model.Concept">
> <ax21:name>Blah<./ax21:name>
> <ax21:guid>Blah2.</ax21:guid>
> </ns:return>
> </ns:getClass1Response>
> </soapenv:Body>
> </soapenv:Envelope>
>
> And when I call that operation from my ADB client, I get the following
> exception:
>
> "org.apache.axis2.AxisFault:
> org.apache.axis2.databinding.ADBException: Unexpected subelement guid"
>
> But I have another operation that is essentially identical, in that it
> has the same signature and returns a different POJO having two
> Strings, just like the first one. I get this back:
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <ns:getZogResponse xmlns:ns="http://service.enterprise.semantica
> <http://service.enterprise.semantica/>">
> <ns:return type="semantica.enterprise.service.Zog">
> <ax23:one>One.</ax23:one>
> <ax23:theOther>The Other.</ax23:theOther>
> </ns:return>
> </ns:getZogResponse>
> </soapenv:Body>
> </soapenv:Envelope>
>
> This one works in the ADB client. The only significant difference I
> see is that the QNames for the return classes is different (ax21 vs.
> ax23). The two classes are basically identical, except that the broken
> code uses a class from a different package than the service class, and
> the working class is in the same package. But why would this be a problem?
>
> Thanks,
> Jason

-- 
Thank you!


http://blogs.deepal.org
http://deepal.org