You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Martin Thurau (JIRA)" <ji...@apache.org> on 2011/05/08 13:05:03 UTC

[jira] [Created] (CXF-3501) DynamicClient fails to send an array of String

DynamicClient fails to send an array of String
----------------------------------------------

                 Key: CXF-3501
                 URL: https://issues.apache.org/jira/browse/CXF-3501
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.4
         Environment: JaxWsDynamicClientFactory and Tomcat 6.
            Reporter: Martin Thurau


I ran into some trouble using {{JaxWsDynamicClientFactory}} to access a SOAP service which signature is unknown a compile time and is passed to my code, from an external part at runtime. Following is a minimal example to reproduce the problem.

The service defines the following operation:

@WebMethod(operationName="init")
	public void initValueNotNull(
			   @WebParam(name="values")String[] values);

I generate a SOAP service and a corresponding WSDL from this by using {{org.apache.cxf.tools.java2ws.JavaToWS}}. Then I generate a WAR file and deploy this to tomcat.

Now I want to use {{JaxWsDynamicClientFactory}} to access this service:
  {{JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();}}
  {{Client client = dcf.createClient(new URL("http://localhost:8080/dserv/ArrayService?wsdl"));}}

  {{String[] values = new String[] { "foobar", "something" };}}
        
  {{client.invoke("init", values);}}

In the implementation of the service I have the following code:
    @Override
    public void initValueNotNull(String[] values) {
        System.out.println("Got values: " + Arrays.asList(values));
    }


I would expect, that the two strings from the client get ouputted. Instead I simple see {{Got values: []}}.

If I look at the SOAP-message that get exchanged, I see the this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:init xmlns:ns1="de.fhl.dserv.ws">
<values xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">foobar</values>
</ns1:init>
</soap:Body>
</soap:Envelope>

So somewhere and somehow the array of strings get transformed in a single string (which happens to be the first element of the original array).

--

I have created a demo project and uploaded it to http://dl.dropbox.com/u/338429/CXF_Bug.zip
Included is a ant file to compile and build the service using {{ant build}} and execute the client using {{ant client}}


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CXF-3501) DynamicClient fails to send an array of String

Posted by "Martin Thurau (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Thurau updated CXF-3501:
-------------------------------

    Description: 
I ran into some trouble using {{JaxWsDynamicClientFactory}} to access a SOAP service which signature is unknown a compile time and is passed to my code, from an external part at runtime. Following is a minimal example to reproduce the problem.

The service defines the following operation:

@WebMethod(operationName="init")
	public void initValueNotNull(
			   @WebParam(name="values")String[] values);

I generate a SOAP service and a corresponding WSDL from this by using {{org.apache.cxf.tools.java2ws.JavaToWS}}. Then I generate a WAR file and deploy this to tomcat.

Now I want to use {{JaxWsDynamicClientFactory}} to access this service:
  JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
  Client client = dcf.createClient(new URL("http://localhost:8080/dserv/ArrayService?wsdl"));

  String[] values = new String[] { "foobar", "something" };
        
  client.invoke("init", values);

In the implementation of the service I have the following code:
    @Override
    public void initValueNotNull(String[] values) {
        System.out.println("Got values: " + Arrays.asList(values));
    }


I would expect, that the two strings from the client get ouputted. Instead I simple see {{Got values: []}}.

If I look at the SOAP-message that get exchanged, I see the this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:init xmlns:ns1="de.fhl.dserv.ws">
<values xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">foobar</values>
</ns1:init>
</soap:Body>
</soap:Envelope>

So somewhere and somehow the array of strings get transformed in a single string (which happens to be the first element of the original array).

--

I have created a demo project and uploaded it to http://dl.dropbox.com/u/338429/CXF_Bug.zip
Included is a ant file to compile and build the service using {{ant build}} and execute the client using {{ant client}}


  was:
I ran into some trouble using {{JaxWsDynamicClientFactory}} to access a SOAP service which signature is unknown a compile time and is passed to my code, from an external part at runtime. Following is a minimal example to reproduce the problem.

The service defines the following operation:

@WebMethod(operationName="init")
	public void initValueNotNull(
			   @WebParam(name="values")String[] values);

I generate a SOAP service and a corresponding WSDL from this by using {{org.apache.cxf.tools.java2ws.JavaToWS}}. Then I generate a WAR file and deploy this to tomcat.

Now I want to use {{JaxWsDynamicClientFactory}} to access this service:
  {{JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();}}
  {{Client client = dcf.createClient(new URL("http://localhost:8080/dserv/ArrayService?wsdl"));}}

  {{String[] values = new String[] { "foobar", "something" };}}
        
  {{client.invoke("init", values);}}

In the implementation of the service I have the following code:
    @Override
    public void initValueNotNull(String[] values) {
        System.out.println("Got values: " + Arrays.asList(values));
    }


I would expect, that the two strings from the client get ouputted. Instead I simple see {{Got values: []}}.

If I look at the SOAP-message that get exchanged, I see the this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:init xmlns:ns1="de.fhl.dserv.ws">
<values xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">foobar</values>
</ns1:init>
</soap:Body>
</soap:Envelope>

So somewhere and somehow the array of strings get transformed in a single string (which happens to be the first element of the original array).

--

I have created a demo project and uploaded it to http://dl.dropbox.com/u/338429/CXF_Bug.zip
Included is a ant file to compile and build the service using {{ant build}} and execute the client using {{ant client}}



> DynamicClient fails to send an array of String
> ----------------------------------------------
>
>                 Key: CXF-3501
>                 URL: https://issues.apache.org/jira/browse/CXF-3501
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.4
>         Environment: JaxWsDynamicClientFactory and Tomcat 6.
>            Reporter: Martin Thurau
>
> I ran into some trouble using {{JaxWsDynamicClientFactory}} to access a SOAP service which signature is unknown a compile time and is passed to my code, from an external part at runtime. Following is a minimal example to reproduce the problem.
> The service defines the following operation:
> @WebMethod(operationName="init")
> 	public void initValueNotNull(
> 			   @WebParam(name="values")String[] values);
> I generate a SOAP service and a corresponding WSDL from this by using {{org.apache.cxf.tools.java2ws.JavaToWS}}. Then I generate a WAR file and deploy this to tomcat.
> Now I want to use {{JaxWsDynamicClientFactory}} to access this service:
>   JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
>   Client client = dcf.createClient(new URL("http://localhost:8080/dserv/ArrayService?wsdl"));
>   String[] values = new String[] { "foobar", "something" };
>         
>   client.invoke("init", values);
> In the implementation of the service I have the following code:
>     @Override
>     public void initValueNotNull(String[] values) {
>         System.out.println("Got values: " + Arrays.asList(values));
>     }
> I would expect, that the two strings from the client get ouputted. Instead I simple see {{Got values: []}}.
> If I look at the SOAP-message that get exchanged, I see the this:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:init xmlns:ns1="de.fhl.dserv.ws">
> <values xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">foobar</values>
> </ns1:init>
> </soap:Body>
> </soap:Envelope>
> So somewhere and somehow the array of strings get transformed in a single string (which happens to be the first element of the original array).
> --
> I have created a demo project and uploaded it to http://dl.dropbox.com/u/338429/CXF_Bug.zip
> Included is a ant file to compile and build the service using {{ant build}} and execute the client using {{ant client}}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CXF-3501) DynamicClient fails to send an array of String

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang resolved CXF-3501.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3.5
                   2.4.1

commit test
http://svn.apache.org/viewvc?rev=1102593&view=rev for trunk
http://svn.apache.org/viewvc?rev=1102605&view=rev for 2.3.x branch

> DynamicClient fails to send an array of String
> ----------------------------------------------
>
>                 Key: CXF-3501
>                 URL: https://issues.apache.org/jira/browse/CXF-3501
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.4
>         Environment: JaxWsDynamicClientFactory and Tomcat 6.
>            Reporter: Martin Thurau
>            Assignee: Freeman Fang
>             Fix For: 2.4.1, 2.3.5
>
>
> I ran into some trouble using {{JaxWsDynamicClientFactory}} to access a SOAP service which signature is unknown a compile time and is passed to my code, from an external part at runtime. Following is a minimal example to reproduce the problem.
> The service defines the following operation:
> @WebMethod(operationName="init")
> 	public void initValueNotNull(
> 			   @WebParam(name="values")String[] values);
> I generate a SOAP service and a corresponding WSDL from this by using {{org.apache.cxf.tools.java2ws.JavaToWS}}. Then I generate a WAR file and deploy this to tomcat.
> Now I want to use {{JaxWsDynamicClientFactory}} to access this service:
>   JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
>   Client client = dcf.createClient(new URL("http://localhost:8080/dserv/ArrayService?wsdl"));
>   String[] values = new String[] { "foobar", "something" };
>         
>   client.invoke("init", values);
> In the implementation of the service I have the following code:
>     @Override
>     public void initValueNotNull(String[] values) {
>         System.out.println("Got values: " + Arrays.asList(values));
>     }
> I would expect, that the two strings from the client get ouputted. Instead I simple see {{Got values: []}}.
> If I look at the SOAP-message that get exchanged, I see the this:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:init xmlns:ns1="de.fhl.dserv.ws">
> <values xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">foobar</values>
> </ns1:init>
> </soap:Body>
> </soap:Envelope>
> So somewhere and somehow the array of strings get transformed in a single string (which happens to be the first element of the original array).
> --
> I have created a demo project and uploaded it to http://dl.dropbox.com/u/338429/CXF_Bug.zip
> Included is a ant file to compile and build the service using {{ant build}} and execute the client using {{ant client}}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CXF-3501) DynamicClient fails to send an array of String

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13032854#comment-13032854 ] 

Freeman Fang commented on CXF-3501:
-----------------------------------

Hi,

Your SEI is incorrect, it shouldn't have @SOAPBinding(style=SOAPBinding.Style.RPC), which will expect pass in net.java.dev.jaxb.array.StringArray as method parameter, this make your dynamic client very hard to use as it don't know this class during compile time at all.

Also for your dynamic client invocation, it should put string values into a list like
{code}
        String[] values = new String[] {"foobar", "something" };
        List<String> list = Arrays.asList(values);
        client.invoke("init", list);
{code}

I'll commit a testcase to demonstrate how it works

Freeman

> DynamicClient fails to send an array of String
> ----------------------------------------------
>
>                 Key: CXF-3501
>                 URL: https://issues.apache.org/jira/browse/CXF-3501
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.4
>         Environment: JaxWsDynamicClientFactory and Tomcat 6.
>            Reporter: Martin Thurau
>            Assignee: Freeman Fang
>
> I ran into some trouble using {{JaxWsDynamicClientFactory}} to access a SOAP service which signature is unknown a compile time and is passed to my code, from an external part at runtime. Following is a minimal example to reproduce the problem.
> The service defines the following operation:
> @WebMethod(operationName="init")
> 	public void initValueNotNull(
> 			   @WebParam(name="values")String[] values);
> I generate a SOAP service and a corresponding WSDL from this by using {{org.apache.cxf.tools.java2ws.JavaToWS}}. Then I generate a WAR file and deploy this to tomcat.
> Now I want to use {{JaxWsDynamicClientFactory}} to access this service:
>   JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
>   Client client = dcf.createClient(new URL("http://localhost:8080/dserv/ArrayService?wsdl"));
>   String[] values = new String[] { "foobar", "something" };
>         
>   client.invoke("init", values);
> In the implementation of the service I have the following code:
>     @Override
>     public void initValueNotNull(String[] values) {
>         System.out.println("Got values: " + Arrays.asList(values));
>     }
> I would expect, that the two strings from the client get ouputted. Instead I simple see {{Got values: []}}.
> If I look at the SOAP-message that get exchanged, I see the this:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:init xmlns:ns1="de.fhl.dserv.ws">
> <values xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">foobar</values>
> </ns1:init>
> </soap:Body>
> </soap:Envelope>
> So somewhere and somehow the array of strings get transformed in a single string (which happens to be the first element of the original array).
> --
> I have created a demo project and uploaded it to http://dl.dropbox.com/u/338429/CXF_Bug.zip
> Included is a ant file to compile and build the service using {{ant build}} and execute the client using {{ant client}}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (CXF-3501) DynamicClient fails to send an array of String

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang reassigned CXF-3501:
---------------------------------

    Assignee: Freeman Fang

> DynamicClient fails to send an array of String
> ----------------------------------------------
>
>                 Key: CXF-3501
>                 URL: https://issues.apache.org/jira/browse/CXF-3501
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.4
>         Environment: JaxWsDynamicClientFactory and Tomcat 6.
>            Reporter: Martin Thurau
>            Assignee: Freeman Fang
>
> I ran into some trouble using {{JaxWsDynamicClientFactory}} to access a SOAP service which signature is unknown a compile time and is passed to my code, from an external part at runtime. Following is a minimal example to reproduce the problem.
> The service defines the following operation:
> @WebMethod(operationName="init")
> 	public void initValueNotNull(
> 			   @WebParam(name="values")String[] values);
> I generate a SOAP service and a corresponding WSDL from this by using {{org.apache.cxf.tools.java2ws.JavaToWS}}. Then I generate a WAR file and deploy this to tomcat.
> Now I want to use {{JaxWsDynamicClientFactory}} to access this service:
>   JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
>   Client client = dcf.createClient(new URL("http://localhost:8080/dserv/ArrayService?wsdl"));
>   String[] values = new String[] { "foobar", "something" };
>         
>   client.invoke("init", values);
> In the implementation of the service I have the following code:
>     @Override
>     public void initValueNotNull(String[] values) {
>         System.out.println("Got values: " + Arrays.asList(values));
>     }
> I would expect, that the two strings from the client get ouputted. Instead I simple see {{Got values: []}}.
> If I look at the SOAP-message that get exchanged, I see the this:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:init xmlns:ns1="de.fhl.dserv.ws">
> <values xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">foobar</values>
> </ns1:init>
> </soap:Body>
> </soap:Envelope>
> So somewhere and somehow the array of strings get transformed in a single string (which happens to be the first element of the original array).
> --
> I have created a demo project and uploaded it to http://dl.dropbox.com/u/338429/CXF_Bug.zip
> Included is a ant file to compile and build the service using {{ant build}} and execute the client using {{ant client}}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira