Re: Axis 1 (1.4) - Simple proof of concept client not working - SAXParserException: Content is not allowed in prolog
I needed to add WEB-INF\server-config.wsdd and add my custom services in that file. After that, I was able to see my custom service. I was able to create custom client and successfully returned the results. There is so much emphasis on deploying using JWS, Admin Console etc. and a lot of emphasis on Tomcat. I wish there were more documentations on steps needed to be taken for app servers other than Tomcat. mule_user wrote: I am new to Axis. I am using Axis 1 (not Axis2). I am trying to make a simple app work. I created a web project called Axis1 which has two modles namely Axis1(which only has META-INF\application.xml) and Axis1Web. Axis1Web has the source code. Axis1Web | ---META-INF | application.xml ?xml version=1.0 encoding=UTF-8? application id=Application_ID version=1.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd; display-name Axis1/display-name module id=WebModule_1255025189235 web web-uriAxis1Web.war/web-uri context-rootAxis1Web/context-root /web /module /application Axis1Web | src | -org.ncc.server | | | Calculator | | | SimpleCalculator | -org.ncc.client (contains code geberated by WSDL2Java) | Axis1WebSoapBindingStub | Calculator | CalculatorService | CalculatorServiceLocator | CalcCleint (written by me, not generated by WSDl2Java) Axis1Web project's WEB-INF\lib contains all the jar files from lib directory of Axis 1 (version 1.4). That is why wsdl2Java generated classes comiple successfully. Axis1Web\WebContent\WEB-INF\web.xml ?xml version=1.0 encoding=UTF-8? web-app id=WebApp_ID version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; display-name Axis1Web/display-name /web-app / Interface in server package: / package org.ncc.server; public interface Calculator { int add (int x, int y); } / Implementation in server package: package org.ncc.server; public class SimpleCalculator { public int add(int a, int b) { return a + b; } } / I copied Calculator.class to C:\Axis. Then I ran the following to generate Java2WSDL. C:\Axisset CLASSPATH=%AXIS_CLASSPATH%;C:\workspace-7.5\Axis1Web\WebContent\WEB- INF\classes C:\Axisjava -classpath %CLASSPATH% org.apache.axis.wsdl.Java2WSDL -o calculator .wsdl -n urn:org.ncc.calculator -l http://localhost:9081/Axis1Web org.ncc.server .Calculator Generated C:\Axis\claculator.wsdl is: / ?xml version=1.0 encoding=UTF-8? wsdl:definitions targetNamespace=urn:org.ncc.calculator xmlns:apachesoap=http://xml.apache.org/xml-soap; xmlns:impl=urn:org.ncc.calculator xmlns:intf=urn:org.ncc.calculator xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:wsdlsoap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; !--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)-- wsdl:message name=addResponse wsdl:part name=addReturn type=xsd:int/ /wsdl:message wsdl:message name=addRequest wsdl:part name=in0 type=xsd:int/ wsdl:part name=in1 type=xsd:int/ /wsdl:message wsdl:portType name=Calculator wsdl:operation name=add parameterOrder=in0 in1 wsdl:input message=impl:addRequest name=addRequest/ wsdl:output message=impl:addResponse name=addResponse/ /wsdl:operation /wsdl:portType wsdl:binding name=Axis1WebSoapBinding type=impl:Calculator wsdlsoap:binding style=rpc transport=http://schemas.xmlsoap.org/soap/http/ wsdl:operation name=add wsdlsoap:operation soapAction=/ wsdl:input name=addRequest wsdlsoap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; namespace=urn:org.ncc.calculator use=encoded/ /wsdl:input wsdl:output name=addResponse wsdlsoap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; namespace=urn:org.ncc.calculator use=encoded/ /wsdl:output /wsdl:operation /wsdl:binding wsdl:service
Axis 1 (1.4) - Simple proof of concept client not working - SAXParserException: Content is not allowed in prolog
I am new to Axis. I am using Axis 1 (not Axis2). I am trying to make a simple app work. I created a web project called Axis1 which has two modles namely Axis1(which only has META-INF\application.xml) and Axis1Web. Axis1Web has the source code. Axis1Web | ---META-INF | application.xml ?xml version=1.0 encoding=UTF-8? application id=Application_ID version=1.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd; display-name Axis1/display-name module id=WebModule_1255025189235 web web-uriAxis1Web.war/web-uri context-rootAxis1Web/context-root /web /module /application Axis1Web | src | -org.ncc.server | | | Calculator | | | SimpleCalculator | -org.ncc.client (contains code geberated by WSDL2Java) | Axis1WebSoapBindingStub | Calculator | CalculatorService | CalculatorServiceLocator | CalcCleint (written by me, not generated by WSDl2Java) Axis1Web project's WEB-INF\lib contains all the jar files from lib directory of Axis 1 (version 1.4). That is why wsdl2Java generated classes comiple successfully. Axis1Web\WebContent\WEB-INF\web.xml ?xml version=1.0 encoding=UTF-8? web-app id=WebApp_ID version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; display-name Axis1Web/display-name /web-app / Interface in server package: / package org.ncc.server; public interface Calculator { int add (int x, int y); } / Implementation in server package: package org.ncc.server; public class SimpleCalculator { public int add(int a, int b) { return a + b; } } / I copied Calculator.class to C:\Axis. Then I ran the following to generate Java2WSDL. C:\Axisset CLASSPATH=%AXIS_CLASSPATH%;C:\workspace-7.5\Axis1Web\WebContent\WEB- INF\classes C:\Axisjava -classpath %CLASSPATH% org.apache.axis.wsdl.Java2WSDL -o calculator .wsdl -n urn:org.ncc.calculator -l http://localhost:9081/Axis1Web org.ncc.server .Calculator Generated C:\Axis\claculator.wsdl is: / ?xml version=1.0 encoding=UTF-8? wsdl:definitions targetNamespace=urn:org.ncc.calculator xmlns:apachesoap=http://xml.apache.org/xml-soap; xmlns:impl=urn:org.ncc.calculator xmlns:intf=urn:org.ncc.calculator xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:wsdlsoap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; !--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)-- wsdl:message name=addResponse wsdl:part name=addReturn type=xsd:int/ /wsdl:message wsdl:message name=addRequest wsdl:part name=in0 type=xsd:int/ wsdl:part name=in1 type=xsd:int/ /wsdl:message wsdl:portType name=Calculator wsdl:operation name=add parameterOrder=in0 in1 wsdl:input message=impl:addRequest name=addRequest/ wsdl:output message=impl:addResponse name=addResponse/ /wsdl:operation /wsdl:portType wsdl:binding name=Axis1WebSoapBinding type=impl:Calculator wsdlsoap:binding style=rpc transport=http://schemas.xmlsoap.org/soap/http/ wsdl:operation name=add wsdlsoap:operation soapAction=/ wsdl:input name=addRequest wsdlsoap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; namespace=urn:org.ncc.calculator use=encoded/ /wsdl:input wsdl:output name=addResponse wsdlsoap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; namespace=urn:org.ncc.calculator use=encoded/ /wsdl:output /wsdl:operation /wsdl:binding wsdl:service name=CalculatorService wsdl:port binding=impl:Axis1WebSoapBinding name=Axis1Web wsdlsoap:address location=http://localhost:9081/Axis1Web/ /wsdl:port /wsdl:service /wsdl:definitions / Next, I ran WSDL2Java C:\Axisjava org.apache.axis.wsdl.WSDL2Java calculator.wsdl This generated 4 classes in C:\Axis. I copy these 4 classes to org.ncc.client package, changed package name inside the classes, compiled these 4 classes. Classes in client package after successful compiling are shown below: / package
Re: Axis 1 (1.4) - Simple proof of concept client not working - SAXParserException: Content is not allowed in prolog
mule_user wrote: I am new to Axis. I am using Axis 1 (not Axis2). I am trying to make a simple app work. I created a web project called Axis1 which has two modles namely Axis1(which only has META-INF\application.xml) and Axis1Web. Axis1Web has the source code. Axis1Web | ---META-INF | application.xml ?xml version=1.0 encoding=UTF-8? application id=Application_ID version=1.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd; display-name Axis1/display-name module id=WebModule_1255025189235 web web-uriAxis1Web.war/web-uri context-rootAxis1Web/context-root /web /module /application Axis1Web | src | -org.ncc.server | | | Calculator | | | SimpleCalculator | -org.ncc.client (contains code geberated by WSDL2Java) | Axis1WebSoapBindingStub | Calculator | CalculatorService | CalculatorServiceLocator | CalcCleint (written by me, not generated by WSDl2Java) Axis1Web project's WEB-INF\lib contains all the jar files from lib directory of Axis 1 (version 1.4). That is why wsdl2Java generated classes comiple successfully. Axis1Web\WebContent\WEB-INF\web.xml ?xml version=1.0 encoding=UTF-8? web-app id=WebApp_ID version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; display-name Axis1Web/display-name /web-app / Interface in server package: / package org.ncc.server; public interface Calculator { int add (int x, int y); } / Implementation in server package: package org.ncc.server; public class SimpleCalculator { public int add(int a, int b) { return a + b; } } / I copied Calculator.class to C:\Axis. Then I ran the following to generate Java2WSDL. C:\Axisset CLASSPATH=%AXIS_CLASSPATH%;C:\workspace-7.5\Axis1Web\WebContent\WEB- INF\classes C:\Axisjava -classpath %CLASSPATH% org.apache.axis.wsdl.Java2WSDL -o calculator .wsdl -n urn:org.ncc.calculator -l http://localhost:9081/Axis1Web org.ncc.server .Calculator Generated C:\Axis\claculator.wsdl is: / ?xml version=1.0 encoding=UTF-8? wsdl:definitions targetNamespace=urn:org.ncc.calculator xmlns:apachesoap=http://xml.apache.org/xml-soap; xmlns:impl=urn:org.ncc.calculator xmlns:intf=urn:org.ncc.calculator xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:wsdlsoap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; !--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)-- wsdl:message name=addResponse wsdl:part name=addReturn type=xsd:int/ /wsdl:message wsdl:message name=addRequest wsdl:part name=in0 type=xsd:int/ wsdl:part name=in1 type=xsd:int/ /wsdl:message wsdl:portType name=Calculator wsdl:operation name=add parameterOrder=in0 in1 wsdl:input message=impl:addRequest name=addRequest/ wsdl:output message=impl:addResponse name=addResponse/ /wsdl:operation /wsdl:portType wsdl:binding name=Axis1WebSoapBinding type=impl:Calculator wsdlsoap:binding style=rpc transport=http://schemas.xmlsoap.org/soap/http/ wsdl:operation name=add wsdlsoap:operation soapAction=/ wsdl:input name=addRequest wsdlsoap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; namespace=urn:org.ncc.calculator use=encoded/ /wsdl:input wsdl:output name=addResponse wsdlsoap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; namespace=urn:org.ncc.calculator use=encoded/ /wsdl:output /wsdl:operation /wsdl:binding wsdl:service name=CalculatorService wsdl:port binding=impl:Axis1WebSoapBinding name=Axis1Web wsdlsoap:address location=http://localhost:9081/Axis1Web/ /wsdl:port /wsdl:service /wsdl:definitions / Next, I ran WSDL2Java C:\Axisjava org.apache.axis.wsdl.WSDL2Java calculator.wsdl This generated 4 classes in C:\Axis. I copy these 4 classes to org.ncc.client