[#5401] - cannot consume webservices based on retrieved wsdl and axis2

Bug report
Feedback Requested
Project: Severity:
Component: Reproducibility:
Assigned to:

I just want to use the stubs generated by axis2 1.5.3 to consume the webservices.
The wsdl should describe the webservice, therefore based on the wsdl i should be able to consume the webservices.

(I know all documentation points to the ireport plugin but I do not want to use that.)

File managementserviceservicestub.java369.82 KB
ruben8550's picture
Joined: Feb 9 2010 - 12:09am
Last seen: 13 years 4 months ago



The requestxmlstring that is defined in the wsdl as a string actually contains an xml:

Instead of :

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<ns1:list xmlns:ns1="http://axis2.ws.jasperserver.jaspersoft.com">

I use:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<axis:list soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<requestXmlString xsi:type="xsd:string">

<request operationName="list" locale="en">
<resourceDescriptor name="test" wsType="folder" uriString="/reports/SoficoReports"
<label>sofico reports</label>
<description>This is a test</description>

It seems to me that the wsdl file is not detailed enough at all.
The resource descriptor should be defined correctly in the wsdl file, this would allow axis to generate a stub for the resourcedescriptor and it would be clear what to send with this "list" methods (probably also goes for other methods)

In addition the stubs generated by the wsdl2java must be adapted which should not be necessary if the resource descriptor was defined in the wsdl.
For example I had to modify a line in the generated list.serialize to get the "list" webservice to work:

if (localRequestXmlString == null) {
// write the nil attribute

throw new org.apache.axis2.databinding.ADBException("requestXmlString cannot be null!!");

} else {
//xmlWriter.writeCharacters(localRequestXmlString); ==> original code. doesn' work, escape characters etc...
// instead use this:



In addition the wsdl also describes it return types as String which is actually a CDATA with an xml in it.
This makes retrieving the content of a document a bit tricky. The "get" service is defined to return a string. So the generated stub only returns a string. To retrieve the attachment from the response, i need to go in the generated stub class and retrieve the attachment from the response that is available there. The returned resource descriptor should contain the attachmentID, but also the attachment (binary data).
That way I would not have to fiddle in the generated stubs.


Hello Ruben,
I suppose that the problem is that you are using wrong parameters in your list request.
The parameter for binding.list function should be a formatted xml string.
(Please, use JasperReports-Server-Web-Services-Guide.pdf for more details)

Your generated binding should work ok.
But here is an example of ant script to generate a working binding & Test sample:

<project name="ws">

<target name="wsdl2java">

&#10;&#10;            &lt;arg value=&quot;-s&quot;/&gt;&#10;            &lt;arg value=&quot;-t&quot;/&gt;&#10;            &lt;arg value=&quot;-S true&quot;/&gt;&#10;            &lt;arg value=&quot;-c be.somepackage.jasperws&quot;/&gt;&#10;            &lt;arg value=&quot;repositry.wsdl&quot;/&gt;&#10;&#10;            &lt;classpath&gt;&#10;                &lt;pathelement location=&quot;../../lib/axis-1.3.jar&quot;/&gt;&#10;                &lt;pathelement location=&quot;../../lib/axis-jaxrpc-1.3.jar&quot;/&gt;&#10;                &lt;pathelement location=&quot;../../lib/axis-saaj-1.3.jar&quot;/&gt;&#10;                &lt;pathelement location=&quot;../../lib/axis-schema.jar&quot;/&gt;&#10;                &lt;pathelement location=&quot;../../lib/commons-discovery-0.2.jar&quot;/&gt;&#10;                &lt;pathelement location=&quot;../../lib/commons-logging-1.1.1.jar&quot;/&gt;&#10;                &lt;pathelement location=&quot;../../lib/wsdl4j-1.5.1.jar&quot;/&gt;&#10;                &lt;pathelement location=&quot;../../lib/log4j-1.2.13.jar&quot;/&gt;&#10;            &lt;/classpath&gt;&#10;        &#10;&#10;    &lt;/target&gt;&#10;&#10;&lt;/project&gt;&#10;&#10;And here is the test you can use to check the list finction forking: &#10;&#10;public void testRepository_List() throws Exception {&#10;        RepositorySoapBindingStub binding = getRepositorySoapBinding();&#10;&#10;        String value = &quot;&lt;request operationName=&quot;list&quot; locale=&quot;en&quot;&gt;\n&quot; +&#10;                &quot;&lt;resourceDescriptor name=&quot;&quot; wsType=&quot;folder&quot; uriString=&quot;/organizations/organization_1&quot;\n&quot; +&#10;                &quot;isNew=&quot;false&quot;&gt;\n&quot; +&#10;                &quot;&lt;label&gt;null&lt;/label&gt;\n&quot; +&#10;                &quot;&lt;/resourceDescriptor&gt;\n&quot; +&#10;                &quot;&lt;/request&gt;&quot;;&#10;        value = binding.list(value);&#10;&#10;//value - contains response xml&#10;}