[ 
https://issues.apache.org/jira/browse/CXF-3320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13819457#comment-13819457
 ] 

Hendrik Geßner commented on CXF-3320:
-------------------------------------

I ran into the same problem, therefore I will provide a WSDL sample:
{noformat}
<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at 
http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. --><!-- 
Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 
2.2.4-b01. --><definitions 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
 xmlns:wsp="http://www.w3.org/ns/ws-policy"; 
xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"; 
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:tns="http://sample/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns="http://schemas.xmlsoap.org/wsdl/"; targetNamespace="http://sample/"; 
name="NameServiceService">
<types>
<xsd:schema>
<xsd:import namespace="http://sample/"; 
schemaLocation="http://localhost:1234/names?xsd=1";></xsd:import>
</xsd:schema>
</types>
<message name="readNames">
<part name="parameters" element="tns:readNames"></part>
</message>
<message name="readNamesResponse">
<part name="parameters" element="tns:readNamesResponse"></part>
</message>
<portType name="NameService">
<operation name="readNames">
<input wsam:Action="http://sample/NameService/readNamesRequest"; 
message="tns:readNames"></input>
<output wsam:Action="http://sample/NameService/readNamesResponse"; 
message="tns:readNamesResponse"></output>
</operation>
</portType>
<binding name="NameServicePortBinding" type="tns:NameService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"; 
style="document"></soap:binding>
<operation name="readNames">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>
<service name="NameServiceService">
<port name="NameServicePort" binding="tns:NameServicePortBinding">
<soap:address location="http://localhost:1234/names";></soap:address>
</port>
</service>
</definitions>
{noformat}

The associated xsd file:
{noformat}
<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at 
http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. --><xs:schema 
xmlns:tns="http://sample/"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
version="1.0" targetNamespace="http://sample/";>

<xs:element name="readNames" type="tns:readNames"></xs:element>

<xs:element name="readNamesResponse" type="tns:readNamesResponse"></xs:element>

<xs:complexType name="readNames">
<xs:sequence></xs:sequence>
</xs:complexType>

<xs:complexType name="readNamesResponse">
<xs:sequence>
<xs:element name="return" type="tns:response" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>

<xs:complexType name="response">
<xs:sequence>
<xs:element name="names">
<xs:complexType>
<xs:sequence>
<xs:element name="entry" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="key" minOccurs="0" type="xs:string"></xs:element>
<xs:element name="value" minOccurs="0" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
{noformat}

Chrome returns the following error:
{noformat}
Uncaught ReferenceError: sample__names_deserialize is not defined 
NameServiceService.js:143
sample__response_deserialize NameServiceService.js:143
sample__readNamesResponse_deserialize NameServiceService.js:72
sample__readNamesResponse_deserializeResponse NameServiceService.js:295
sample__readNames_op_onsuccess NameServiceService.js:234
client.onsuccess NameServiceService.js:270
org_apache_cxf_client_onReadyState cxf-utils.js:936
req.onreadystatechange cxf-utils.js:746
{noformat}

> wsdl2js generated code fails to parse a Java Map<String, String> property
> -------------------------------------------------------------------------
>
>                 Key: CXF-3320
>                 URL: https://issues.apache.org/jira/browse/CXF-3320
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding, JavaScript Client
>    Affects Versions: 2.2.4, 2.2.12, 2.3.2
>         Environment: Windows XP SP3 Pro English, JDK 1.6.0.20, Aegis, CXF on 
> server side is 2.2.4
>            Reporter: Robbie Gieze
>              Labels: wsdl2js
>
> I'm using Apache CXF to expose a Java object through SOAP which has the 
> following property:
> private Map<String,String> constraintParams;
> This gives me a correct WSDL file and I can use the SOAP method with no 
> problems from tools like soapUI.
> But I want to use the SOAP service from javascript. So I use the wsdl2js tool 
> of CXF and it generates a .js file. When I use the javascript file it fails 
> to parse the SOAP response from the server. 
> The SOAP XML part that the javascript code fails to deserialize looks like 
> this:
>   <ns3:constraintParams>
>     <ns1:entry>
>       <ns1:key>regex</ns1:key>
>       <ns1:value>^.+$</ns1:value>
>     </ns1:entry>
>   </ns3:constraintParams>
> It seems like the generated js code tries to deserialize the <entry> tag but 
> the wsdl2js generator didn't actually generate that function, so the code of 
> the generator is calling a function that it didn't generate. The following 
> line in the js gives a 
> "services_systemcontrol_mydomain_com__entry_deserialize" is not defined" 
> error.
>    arrayItem = 
> services_systemcontrol_mydomain_com__entry_deserialize(cxfjsutils, 
> curElement);
> At this moment the curElement property has the <entry> tag but the 
> deserialize function simply is not in the generated js file.
> Do I do anything wrong or is there another way that does work that I could 
> look into?
> On the server side I'm using 2.2.4, I tested the wsdl2js tool of versions 
> 2.2.4, 2.2.12, 2.3.2 the result is always as above. I'm also using aegis



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to