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 jnedzel <jn...@broad.mit.edu> on 2007/05/23 22:08:24 UTC

[Axis2] Required element null defined...

I'm having problems creating a simple REST service that takes an 
argument, using a POJO.

The service works fine if the method does not take any parameters.  If 
it does take a parameter, then I get the message:

	Required element null defined in the schema can not be found in the request

when I try to access it from a browser.

I'm using axis2 v1.1.1

My service class is dirt simple:


package org.genecruiser.service;

public class VariationService {
	public String geneid(String id) {
		
		return "hello world: " + id;
	}
}

My services.xml is simple as well:

<service name="variation" scope="application">
	<description>
		Returns variations given a feature as input.
	</description>
	<messageReceivers>
		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" 
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" 
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>		
	</messageReceivers>
	<parameter name="ServiceTCCL">composite</parameter>
	<parameter name="ServiceClass">
		org.genecruiser.service.VariationService
	</parameter>
</service>		

If I remove the id argument from the geneid() method, then pointing my 
browser to this url works fine:

http://localhost:8080/axis2/rest/variation/geneid

With the id argument in place, I point my browser to this url:

http://localhost:8080/axis2/rest/variation/geneid?id=foo

and get the error message:

Required element null defined in the schema can not be found in the request

Any ideas?

-- 
Jared Nedzel
Cancer Genomics Informatics
Broad Institute


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


Re: [Axis2] Required element null defined...

Posted by jnedzel <jn...@broad.mit.edu>.
Ognjen:

Many thanks -- that worked.

It would be great if this was put into the FAQ and the manual.

Jared

Ognjen Blagojevic wrote:
> This is a Java compiler issue.
> 
> When you compile your web service class, the resulting .class file have 
> no information about parameter names. Since axis2 is parsing .class 
> files, it can't know the original parameter name. Hence, it calls the 
> parameters param0, param1 and so on.
> 
> Workaround for this problem is to compile classes with -g parameter, 
> which will keep all kind of information in your .class files for 
> debugging purposes, including parameter names. In this case, axis2 will 
> use it and generate appropriate parameter names. In your case, "id".
> 
> 
> (I really think this issue should be in FAQ.)
> 
> Regards,
> Ognjen


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


Re: [Axis2] Required element null defined...

Posted by Ognjen Blagojevic <og...@etf.bg.ac.yu>.
Hi,

This is a Java compiler issue.

When you compile your web service class, the resulting .class file have 
no information about parameter names. Since axis2 is parsing .class 
files, it can't know the original parameter name. Hence, it calls the 
parameters param0, param1 and so on.

Workaround for this problem is to compile classes with -g parameter, 
which will keep all kind of information in your .class files for 
debugging purposes, including parameter names. In this case, axis2 will 
use it and generate appropriate parameter names. In your case, "id".


(I really think this issue should be in FAQ.)

Regards,
Ognjen


jnedzel wrote:
> I'll see if I can try that.
> 
> I found out that the url that I needed to use was:
> 
> http://localhost:8080/axis2/rest/variation/geneid?param0=foo
>                                                   ^^^^^^
> Rather than:
> 
> http://localhost:8080/axis2/rest/variation/geneid?id=foo
>                                                   ^^
> Does V1.2 fix this?  Or can I specify the argument name in services.xml 
> without creating a WSDL?

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


Re: [Axis2] Required element null defined...

Posted by jnedzel <jn...@broad.mit.edu>.
I'll see if I can try that.

I found out that the url that I needed to use was:

http://localhost:8080/axis2/rest/variation/geneid?param0=foo
                                                   ^^^^^^
Rather than:

http://localhost:8080/axis2/rest/variation/geneid?id=foo
                                                   ^^
Does V1.2 fix this?  Or can I specify the argument name in services.xml 
without creating a WSDL?

Thanks,

Jared


Davanum Srinivas wrote:
> Could u please try Axis2 1.2? I believe we've fixed this problem.
> 
> thanks,
> dims


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


Re: [Axis2] Required element null defined...

Posted by Davanum Srinivas <da...@gmail.com>.
Could u please try Axis2 1.2? I believe we've fixed this problem.

thanks,
dims

On 5/23/07, jnedzel <jn...@broad.mit.edu> wrote:
> I'm having problems creating a simple REST service that takes an
> argument, using a POJO.
>
> The service works fine if the method does not take any parameters.  If
> it does take a parameter, then I get the message:
>
>         Required element null defined in the schema can not be found in the request
>
> when I try to access it from a browser.
>
> I'm using axis2 v1.1.1
>
> My service class is dirt simple:
>
>
> package org.genecruiser.service;
>
> public class VariationService {
>         public String geneid(String id) {
>
>                 return "hello world: " + id;
>         }
> }
>
> My services.xml is simple as well:
>
> <service name="variation" scope="application">
>         <description>
>                 Returns variations given a feature as input.
>         </description>
>         <messageReceivers>
>                 <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
>                 <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
> class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
>         </messageReceivers>
>         <parameter name="ServiceTCCL">composite</parameter>
>         <parameter name="ServiceClass">
>                 org.genecruiser.service.VariationService
>         </parameter>
> </service>
>
> If I remove the id argument from the geneid() method, then pointing my
> browser to this url works fine:
>
> http://localhost:8080/axis2/rest/variation/geneid
>
> With the id argument in place, I point my browser to this url:
>
> http://localhost:8080/axis2/rest/variation/geneid?id=foo
>
> and get the error message:
>
> Required element null defined in the schema can not be found in the request
>
> Any ideas?
>
> --
> Jared Nedzel
> Cancer Genomics Informatics
> Broad Institute
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Davanum Srinivas :: http://davanum.wordpress.com

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