Hello everyone
I'm currently developing part of an application that will invoke SOAP
services. The operation-name, the parameters and their types are
unknown at compile time and will passed to my code at runtime. The
potential type include Strings, Floats, Integer and Arrays of the
them.
Using JaxWsDynamicClientFactory I have no problem sending the first
three but I'm stuck with arrays. My test code currently looks like
this:

        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
        Client client = dcf.createClient(new
URL("http://localhost:8080/dserv/DQCheckValueNotNull?wsdl";));
        
client.getRequestContext().put(org.apache.cxf.message.Message.MAINTAIN_SESSION,
Boolean.TRUE);

        String[] params = new String[] { "null", "something" };

        client.invoke("initValueNotNull", params);

However, at the server side, only an empty array is received. My guess
is, that since invoke is a varargs method, the values of the array are
somehow "unpacked" into single parameters. If I look at the messages
using wireshark I can see the following soap-message:

<soap:Envelope 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><soap:Body><ns1:initValueNotNull
xmlns:ns1="de.fhl.dserv">    <nullValues
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xsi:type="xs:string">null</nullValues></ns1:initValueNotNull></soap:Body></soap:Envelope>

The "initValueNotNull" operation accepts an array of Strings
(according to the WSDL-file that is used to fetch the operation at
runtime):
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="DQCheckValueNotNullImplService"
targetNamespace="de.fhl.dserv"
xmlns:ns1="http://jaxb.dev.java.net/array";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:tns="de.fhl.dserv"
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://jaxb.dev.java.net/array"; version="1.0">
<xs:complexType final="#all" name="stringArray">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="item"
nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="initValueNotNullResponse">
  </wsdl:message>
  <wsdl:message name="initValueNotNull">
    <wsdl:part name="nullValues" type="ns1:stringArray">
    </wsdl:part>
  </wsdl:message>
[...]

Can somebody help me? :)

Reply via email to