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 Alison Stevenson <se...@hotmail.com> on 2003/09/22 14:12:24 UTC

Service method parameter: Vector

Hello,

I'd be grateful for any help people can provide:

I have a client which creates an array of SOAPBodyElements and uses this as 
the input parameter to a call on a service. The service method exposed 
requires an Vector an input.

The client appears to send a valid SOAP message (see below) but the Service 
reports that it has received a NULL input.

To enable the Service to get array of SOAPBodyElements should the Service 
method specify a different parameter? I tried rewriting the method so that 
it took an array of SOAPBodyElements but got the same error.

I set the Operation style property on the Service Call to be document. Is 
this correct?

I'm running the Service using the JBoss jboss-net axis.

As I said I'd appreciate any suggestions.

Regards,

Alison

Example code follows:

Client:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

String endpoint = "http://localhost:8070/jboss-net/services/SRW";
String methodName = "searchRetrieve";

Service  service = new Service();
Call     call    = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(methodName);
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");

SOAPBodyElement[] input = buildInput();
Vector          elems = (Vector) call.invoke( input );
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Service:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public Element[] searchRetrieve(Vector elems)
  {
   if(elems == null){
    System.out.println("Service : NULL input");
  }
  else{
     System.out.println("Service : Input not null");
    }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SOAP Message
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:searchRetrieve xmlns:ns1="searchRetrieve">Request</ns1:searchRetrieve>
<query>http://........../rdf/oai_dc.rdf#subject = 
&apos;PHOTOGRAPH&apos;</query>
<recordSchemaId>oai_dc</recordSchemaId>
</soapenv:Body>
</soapenv:Envelope>

NB what I want to happen is that the service gets a vector which contains 
the two elements from the message (ie query and recordSchemaId).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_________________________________________________________________
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger