Hello,
I'm having a problem getting Axis to automatically generate a WSDL for a
deployed web service. My end goal is to have a .NET c# client consume a
Axis web service that returns XML documents. First the Java Code:
------------------
package GMML.interfaces.literal;
import org.w3c.dom.*;
import javax.xml.parsers.*;
public class ConnectivityTest {
public org.w3c.dom.Element connectivity () {
Element toReturn = null;
Element firstLevelChild = null;
Element secondLevelChild = null;
Document document = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
//create a new document
document = builder.newDocument();
toReturn = (Element) document.createElement("Root");
firstLevelChild = (Element) document.createElement("level1");
secondLevelChild = (Element) document.createElement("level2");
document.appendChild(toReturn);
toReturn.appendChild(firstLevelChild);
firstLevelChild.appendChild(secondLevelChild);
} catch (Exception e) {
e.printStackTrace();
}
return toReturn;
}
}
----------------------------
Now the .wsdd file:
----------------------------
<deployment xmlns="http://xml.apache.org/axis/wsdd/">
<service name="Connectivity" style="document">
<parameter name="className"
value="GMML.interfaces.literal.ConnectivityTest"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
----------------------------
If I use Java2WSDL everything works ok, but if I go to
http://localhost:8080/axis/services/Connectivity?wsdl
I get the following errors:
----------------------------
AXIS error
Sorry, something seems to have gone wrong... here are the details:
Fault - WSDLException: faultCode=PARSER_ERROR: Problem parsing '- WSDL
Document -'.: The value of the attribute "xmlns:tns1" is invalid. Prefixed
namespace bindings may not be empty.: org.xml.sax.SAXParseException: The
value of the attribute "xmlns:tns1" is invalid. Prefixed namespace bindings
may not be empty.
at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:267)
at
org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:20
1)
at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)
at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)
at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:269)
at
org.apache.axis.providers.java.JavaProvider.generateWSDL(JavaProvider.java:4
78)
at org.apache.axis.strategies.WSDLGenStrategy.visit(WSDLGenStrategy.java:72)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:156)
at org.apache.axis.SimpleChain.generateWSDL(SimpleChain.java:143)
at
org.apache.axis.handlers.soap.SOAPService.generateWSDL(SOAPService.java:368)
at org.apache.axis.server.AxisServer.generateWSDL(AxisServer.java:491)
at
org.apache.axis.transport.http.AxisServlet.processWsdlRequest(AxisServlet.ja
va:434)
at org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:286)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:
339)
...
-----------------------------------------
Secondly, with Java2WSDL, and WSDL2Java I create stubs and they work fine,
but when I use a Test client with the following code:
-------------------------------
package GMML.interfaces.literal;
import org.w3c.dom.Element;
public class Test {
public static void main(String[] argv) {
ConnectivityTestServiceLocator locator = new
ConnectivityTestServiceLocator();
try {
ConnectivityTest service = locator.getConnectivity();
Element returned = service.connectivity();
if(returned != null) {
System.out.println(service.connectivity().toString());
}
else {
System.out.println("Returned NULL");
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
-------------------------
I don't get the <daRoot> element back; The element I get starts at <level1>,
but I can see the <daRoot> element in the wire trace. This isn't as big of
an issue because I can just pad in another element, but it would be nice if
I didn't have to.
Any ideas on what is causing the first error? And do you see any other
forecoming pitfalls?
Thanks,
-Wes