Note that there are some explanatory texts on larger screens.

plurals
  1. POSending array of string as a parameter to web service method using JAXRPC
    primarykey
    data
    text
    <p>I've got problem sending an array of string as parameter to a web service method, given in a specific wsdl. When am trying to send an array of strings, I get the following error.</p> <h2>Error:</h2> <pre><code>AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: org.xml.sax.SAXException: Bad types (class java.util.ArrayList &amp;gt; class usdjws65.ArrayOfString) faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}hostname:SSLSPSD001 org.xml.sax.SAXException: Bad types (class java.util.ArrayList -&gt; class usdjws65.ArrayOfString) at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129) at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) </code></pre> <h2>Code written:</h2> <pre><code>Call call1 = objService1.createCall(port1); call1.setTargetEndpointAddress(targetEndPoint); call1.addParameter("int_1", XMLType.XSD_INT, Integer.class, ParameterMode.IN); call1.addParameter("String_1", QNAME_TYPE_STRING, ParameterMode.IN); call1.addParameter("String_2", QNAME_TYPE_STRING_ARRAY, java.lang.String[].class, ParameterMode.IN); call1.addParameter("String_3", QNAME_TYPE_STRING_ARRAY, java.lang.String[].class, ParameterMode.IN); call1.addParameter("String_4", QNAME_TYPE_STRING, ParameterMode.IN); call1.addParameter("String_5", QNAME_TYPE_STRING_ARRAY, java.lang.String[].class, ParameterMode.IN); call1.addParameter("String_6", QNAME_TYPE_STRING, ParameterMode.IN); call1.addParameter("String_7", QNAME_TYPE_STRING, ParameterMode.IN); // --- Done adding PARAM's String[] attrVals = { "description", "test from soapUI", "customer", ticketHandle, "type", "I" }; String[] attributes = { "status", "ref_num" }; Object[] params1 = { new Integer(sid), ticketHandle, attrVals, "", "cr_tpl:400005", attributes, "", "" }; String res = null; try { call1.invoke(params1); </code></pre> <p>Thanks !!!! -Aj</p> <p>=========================================================</p> <h2><strong>Update-1</strong>:</h2> <p>I added a class named ArrayOfString with following code in it. protected java.lang.String[] string;</p> <pre><code>public ArrayOfString() { } public ArrayOfString(java.lang.String[] string) { this.string = string; } public java.lang.String[] getString() { return string; } public void setString(java.lang.String[] string) { this.string = string; } </code></pre> <p>and thus did the following, ArrayOfString attrVals = new ArrayOfString(); attrVals.setString(new String[] { "customer", "test from soapUI", "customer", ticketHandle, "type", "I" });</p> <p>Similarly, for attributes variable of type 'ArrayOfString'.</p> <p>But now, I get the following error:: </p> <blockquote> <p>AxisFault faultCode: {<a href="http://schemas.xmlsoap.org/soap/envelope/" rel="nofollow">http://schemas.xmlsoap.org/soap/envelope/</a>}Server.userException faultSubcode: faultString: java.io.IOException: No serializer found for class ArrayOfString in registry org.apache.axis.encoding.TypeMappingDelegate@ef2c60 faultActor: faultNode: faultDetail: {<a href="http://xml.apache.org/axis/" rel="nofollow">http://xml.apache.org/axis/</a>}stackTrace:java.io.IOException: No serializer found for class ArrayOfString in registry org.apache.axis.encoding.TypeMappingDelegate@ef2c60 at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1507) at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980) at org.apache.axis.encoding.SerializationContext.outputMultiRefs(SerializationContext.java:1055) at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:145) at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478) at org.apache.axis.message.MessageElement.output(MessageElement.java:1208) at org.apache.axis.client.Call.invoke(Call.java:2757) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812)</p> </blockquote> <hr> <h2><strong>Update-2:</strong></h2> <p>Here is an update on the problem that am facing. In the WSDL file, I found something like this,</p> <pre><code>complexType name="ArrayOfString" sequence element maxOccurs="unbounded" name="string" type="xsd:string" / /sequence /complexType </code></pre> <p>Well, now that am meant to use this method, </p> <pre><code> &lt;element name="createRequest"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="sid" type="xsd:int" /&gt; &lt;element name="creatorHandle" type="xsd:string" /&gt; &lt;element name="attrVals" type="impl:ArrayOfString" /&gt; &lt;element name="propertyValues" type="impl:ArrayOfString" /&gt; &lt;element name="template" type="xsd:string" /&gt; &lt;element name="attributes" type="impl:ArrayOfString" /&gt; &lt;element name="newRequestHandle" type="xsd:string" /&gt; &lt;element name="newRequestNumber" type="xsd:string" /&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/element&gt; </code></pre> <p>Now, I tried sending the parameters 'attrVals','attibutes' like this</p> <pre><code>ArrayOfstring attrVals = new ArrayOfstring(); ArrayOfstring attributes = new ArrayOfstring(); attrVals.setString(new String[] { "customer", "test from soapUI", "customer", ticketHandle, "type", "I" }); attributes.setString(new String[] { "status", "ref_num" }); </code></pre> <p>Its throwing the following exception</p> <pre><code>AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.io.IOException: No serializer found for class org.tempuri.complex.data.arrays.xsd.ArrayOfstring in registry org.apache.axis.encoding.TypeMappingDelegate@11e1e67 faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:java.io.IOException: No serializer found for class org.tempuri.complex.data.arrays.xsd.ArrayOfstring in registry org.apache.axis.encoding.TypeMappingDelegate@11e1e67 at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1507) at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload