Category: | Bug report |
Priority: | Normal |
Status: | Feedback Requested |
Project: | Severity: | Major |
Resolution: | Open |
|
Component: | Reproducibility: | Always |
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.)
3 Comments:
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/">
<soapenv:Body>
<ns1:list xmlns:ns1="http://axis2.ws.jasperserver.jaspersoft.com">
<requestXmlString>/reports/SoficoReports</requestXmlString>
</ns1:list>
</soapenv:Body>
</soapenv:Envelope>
I use:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:axis="http://axis2.ws.jasperserver.jaspersoft.com">
<soapenv:Header/>
<soapenv:Body>
<axis:list soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<requestXmlString xsi:type="xsd:string">
<![CDATA[
<request operationName="list" locale="en">
<resourceDescriptor name="test" wsType="folder" uriString="/reports/SoficoReports"
isNew="false">
<label>sofico reports</label>
<description>This is a test</description>
<value>/</value>
</resourceDescriptor>
</request>
]]>
</requestXmlString>
</axis:list>
</soapenv:Body>
</soapenv:Envelope>
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:
xmlWriter.writeCData(localRequestXmlString);
}
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">
<arg value="-s"/> <arg value="-t"/> <arg value="-S true"/> <arg value="-c be.somepackage.jasperws"/> <arg value="repositry.wsdl"/> <classpath> <pathelement location="../../lib/axis-1.3.jar"/> <pathelement location="../../lib/axis-jaxrpc-1.3.jar"/> <pathelement location="../../lib/axis-saaj-1.3.jar"/> <pathelement location="../../lib/axis-schema.jar"/> <pathelement location="../../lib/commons-discovery-0.2.jar"/> <pathelement location="../../lib/commons-logging-1.1.1.jar"/> <pathelement location="../../lib/wsdl4j-1.5.1.jar"/> <pathelement location="../../lib/log4j-1.2.13.jar"/> </classpath> </target> </project> And here is the test you can use to check the list finction forking: public void testRepository_List() throws Exception { RepositorySoapBindingStub binding = getRepositorySoapBinding(); String value = "<request operationName="list" locale="en">\n" + "<resourceDescriptor name="" wsType="folder" uriString="/organizations/organization_1"\n" + "isNew="false">\n" + "<label>null</label>\n" + "</resourceDescriptor>\n" + "</request>"; value = binding.list(value); //value - contains response xml }