Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Problem with mapping Array String into HashMap in Axis

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody!! this is my first entry

I have a serious problem

I created a client for a Web service from the wsdl with wsdl2java. The method I have to invoke takes as a parameter the following object :

public class RequestMailVO implements java.io.Serializable {
private java.lang.String attachmentByte;

private java.lang.String attachmentName;

private java.lang.String code;

private java.util.HashMap datosPlantillas;

private java.lang.String idioma;

private int mailFormat;

private java.lang.String[] to;

... set/get methods
}

, this object has a HashMap as an attribute. When HashMap is filled with <String,String> no problem, the client works , but when I send something like <String,String[]> I have the following exception :


org.xml.sax.SAXException: No deserializer for {urn:PosadasMailSender}ArrayOf_xsd_string
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)

I checked the stub is created and I see that this mapping:

qName = new javax.xml.namespace.QName("urn:PosadasMailSender", "ArrayOf_xsd_string");
cachedSerQNames.add(qName);
cls = java.lang.String[].class;
cachedSerClasses.add(cls);
qName = new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string");
qName2 = new javax.xml.namespace.QName("urn:PosadasMailSender", "item");
cachedSerFactories.add(new org.apache.axis.encoding.ser.ArraySerializerFactory(qName, qName2));
cachedDeserFactories.add(new org.apache.axis.encoding.ser.ArrayDeserializerFactory());

that corresponds to the following part of the wsdl:

<complexType name="ArrayOf_xsd_string">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:string"/>
</sequence>
</complexType>

"ArrayOf_xsd_string" describes the attribute "to" of the Object RequestMailVO.

Help me please !!!
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post a very small wsdl that is representative of the problem, and also mention what you are trying to do? I can then run wsdl2java and try to duplicate the issue. If you already have a solution, kindly post it!
 
Jesus Chavez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The WSDL is following:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:PosadasMailSender" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:PosadasMailSender" xmlns:intf="urn:PosadasMailSender" xmlns:tns1="http://model.email.wishman.posadas.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="urn:PosadasMailSender"/>
<import namespace="http://model.email.wishman.posadas.com"/>
<complexType name="mapItem">
<sequence>
<element name="key" nillable="true" type="xsd:anyType"/>
<element name="value" nillable="true" type="xsd:anyType"/>
</sequence>
</complexType>
<complexType name="Map">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified" targetNamespace="urn:PosadasMailSender" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://xml.apache.org/xml-soap"/>
<import namespace="http://model.email.wishman.posadas.com"/>
<complexType name="ArrayOf_xsd_string">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:string"/>
</sequence>
</complexType>
<element name="sendMailAttachRequest" type="tns1:RequestMailAttachType"/>
<element name="sendMailAttachResponse" type="xsd:boolean"/>
<element name="in0" type="tns1:RequestMailVO"/>
<element name="sendMailReturn" type="xsd:boolean"/>
<element name="in1" type="tns1:RequestMailVO"/>
<element name="sendMailNotRulesReturn" type="xsd:boolean"/>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://model.email.wishman.posadas.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://xml.apache.org/xml-soap"/>
<import namespace="urn:PosadasMailSender"/>
<complexType name="AttachmentType">
<sequence>
<element name="attachmentByte" type="xsd:string"/>
<element name="attachmentName" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="RequestMailAttachType">
<sequence>
<element name="code" nillable="true" type="xsd:string"/>
<element name="datosPlantillas" nillable="true" type="apachesoap:Map"/>
<element name="idioma" nillable="true" type="xsd:string"/>
<element name="mailFormat" type="xsd:int"/>
<element name="to" nillable="true" type="impl:ArrayOf_xsd_string"/>
<element maxOccurs="unbounded" minOccurs="0" name="attachments" type="tns1:AttachmentType"/>
</sequence>
</complexType>
<complexType name="RequestMailVO">
<sequence>
<element name="attachmentByte" nillable="true" type="xsd:string"/>
<element name="attachmentName" nillable="true" type="xsd:string"/>
<element name="code" nillable="true" type="xsd:string"/>
<element name="datosPlantillas" nillable="true" type="apachesoap:Map"/>
<element name="idioma" nillable="true" type="xsd:string"/>
<element name="mailFormat" type="xsd:int"/>
<element name="to" nillable="true" type="impl:ArrayOf_xsd_string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>

<wsdl:message name="sendMailNotRulesRequest">

<wsdl:part element="impl:in1" name="in1"/>

</wsdl:message>

<wsdl:message name="sendMailRequest">

<wsdl:part element="impl:in0" name="in0"/>

</wsdl:message>

<wsdl:message name="sendMailResponse">

<wsdl:part element="impl:sendMailReturn" name="sendMailReturn"/>

</wsdl:message>

<wsdl:message name="sendMailNotRulesResponse">

<wsdl:part element="impl:sendMailNotRulesReturn" name="sendMailNotRulesReturn"/>

</wsdl:message>

<wsdl:message name="sendMailAttachResponse">

<wsdl:part element="impl:sendMailAttachResponse" name="sendMailAttachResponse"/>

</wsdl:message>

<wsdl:message name="sendMailAttachRequest">

<wsdl:part element="impl:sendMailAttachRequest" name="sendMailAttachRequest"/>

</wsdl:message>

<wsdl:portType name="EmailManagerService">

<wsdl:operation name="sendMailAttach" parameterOrder="sendMailAttachRequest">

<wsdl:input message="impl:sendMailAttachRequest" name="sendMailAttachRequest"/>

<wsdl:output message="impl:sendMailAttachResponse" name="sendMailAttachResponse"/>

</wsdl:operation>

<wsdl:operation name="sendMail" parameterOrder="in0">

<wsdl:input message="impl:sendMailRequest" name="sendMailRequest"/>

<wsdl:output message="impl:sendMailResponse" name="sendMailResponse"/>

</wsdl:operation>

<wsdl:operation name="sendMailNotRules" parameterOrder="in1">

<wsdl:input message="impl:sendMailNotRulesRequest" name="sendMailNotRulesRequest"/>

<wsdl:output message="impl:sendMailNotRulesResponse" name="sendMailNotRulesResponse"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="PosadasMailSenderSoapBinding" type="impl:EmailManagerService">

<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="sendMailAttach">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="sendMailAttachRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="sendMailAttachResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="sendMail">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="sendMailRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="sendMailResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="sendMailNotRules">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="sendMailNotRulesRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="sendMailNotRulesResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="EmailManagerServiceService">

<wsdl:port binding="impl:PosadasMailSenderSoapBinding" name="PosadasMailSender">

<wsdlsoap:address location="http://200.76.54.13:9090/posadasMailSender/services/PosadasMailSender"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>


the problem is when I send the Map "datosPlantilla" with <String,String[]>

Help me please
 
R Srini
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The wsdl is not valid when copy/pasted. Please edit your post, and wrap your wsdl inside a codetag by selecting the wsdl text and pressing the code button above, and click Preview to make sure that its readable. I'll try to look at it soon.
 
Jesus Chavez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry


 
R Srini
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I run this in Axis2 1.5.1:
I get:

Compared to your generated class, mine implements ADBBean instead of Serializable and looks quite different.

- Are you using the old Axis or Axis2?
- You probably need to construct an ArrayOf_xsd_string object from your string array, and then put that object in your map. How are you passing a string array in your client code? Please post the code fragment.

I hope this is making sense.
 
Jesus Chavez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for you time in this problem

I'm working with Axis 1.4 (I'm limited , you know )

I created the object you say(ArrayOf_xsd_string), but the result is the same .
In my generated stub (java org.apache.axis.wsdl.WSDL2Java -o build/ -d Application -s test.wsdl) I heve the following for string[]:



 
Jesus Chavez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry, I clicked by mistake in submit

I'm working with Axis 1.4 (I'm limited , you know )

I created the object you say(ArrayOf_xsd_string), but the result is the same .
In my generated stub (java org.apache.axis.wsdl.WSDL2Java -o build/ -d Application -s test.wsdl) I have the following for "register type mapping":




In my main Class I have:



When run my client, get the following error:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: No deserializer for {urn:PosadasMailSender}ArrayOf_xsd_string
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}



With the object ArrayOf_xsd_string, I change in my stub to:



In my main Class


When run my client I get the same error
 
R Srini
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. If its the old Axis 1.4, then I can't be of much help. A few thoughts;

1. The stub contains the classes you need to use in your client. I don't think its meant to be modified.

qName = new javax.xml.namespace.QName("urn:PosadasMailSender", "ArrayOf_xsd_string");


2. I don't know if the above is valid, but I am not sure.


For this type:
<complexType name="RequestMailVO">
<sequence>
<element name="attachmentByte" nillable="true" type="xsd:string"/>
<element name="attachmentName" nillable="true" type="xsd:string"/>
<element name="code" nillable="true" type="xsd:string"/>
<element name="datosPlantillas" nillable="true" type="apachesoap:Map"/>
<element name="idioma" nillable="true" type="xsd:string"/>
<element name="mailFormat" type="xsd:int"/>
<element name="to" nillable="true" type="impl:ArrayOf_xsd_string"/>
</sequence>
</complexType>

RequestMailVO mail = new RequestMailVO();
final String[] policies=new String[]{"POLICY1","POLICY2"};

******************Why are you doing this:*******************
mail.setDatosPlantillas((HashMap)mapping);
*****************Instead of:**********************
mail.setTo(new ArrayOf_xsd_string().set(policies)) or something like that


3. In the above example you have shown, per the wsdl, in RequestMailVO:
-- to is of type ArrayOf_xsd_string
-- datosPlantillas is of type Map.
So then why are you adding the string array to datosPlantillas? Maybe I am missing something. Shouldn't the string array be added to the "to" property?


Can you try this approach:
- use the generated stub
- in the stub, take a look at the public inner classes that can be accessed from your client code
- For a service called "Your", you should be able to say something like this:
yourUrl = "http://yoururl/";
QName myQname = new QName("http://yournamespaceurl/", "YourService");
YourService service = new YourService(yourUrl, myQname);
binding = service.getYourPort();
RequestMailVO mail = new RequestMailVO();
final String[] policies=new String[]{"POLICY1","POLICY2"};
mail.setTo(policies in string array type)
mail.set other values also
binding.sendMail(mail);

Best of luck! Please do post your solution once you have it.
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I could generate the stubs and the impl code based on the wsdl provided.
I put some dummy code in the PosadasMailSenderSoapBindingImpl.java.
Wrote the client in the following way .


I did not got any exception and got the response.

Regards,
Amit
 
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic