Hi again !!! :
I've not received too much help, Axis 2 docs have not helped me at
all, so I've tried new things. I've tried to create this class :
package code;
public class Testing {
public ExternalClass returnExternalClass() {
return new ExternalClass(false, "external message", new
InternalClass("internal message"));
}
}
(ExternalClass and InternalClass are the same as in the last post).
Then I've run the "Axis 2 code generator" Eclipse plugin to generate a
"services.wsdl" WSDL from this class. The generated WSDL is :
<wsdl:definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:xsd="http://code/xsd"
xmlns:ns="http://code" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://code">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="http://code/xsd">
<xs:element name="returnExternalClassResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" nillable="true"
type="xsd:ExternalClass"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ExternalClass" type="xsd:ExternalClass"/>
<xs:complexType name="ExternalClass">
<xs:sequence>
<xs:element name="error" type="xs:boolean"/>
<xs:element name="internalClass" nillable="true"
type="xsd:InternalClass"/>
<xs:element name="message" nillable="true"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="InternalClass" type="xsd:InternalClass"/>
<xs:complexType name="InternalClass">
<xs:sequence>
<xs:element name="internalMessage" nillable="true"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="returnExternalClassMessage"/>
<wsdl:message name="returnExternalClassResponseMessage">
<wsdl:part name="part1" element="xsd:returnExternalClassResponse"/>
</wsdl:message>
<wsdl:portType name="TestingPortType">
<wsdl:operation name="returnExternalClass">
<wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
wsaw:Action="urn:returnExternalClass"
message="ns:returnExternalClassMessage"/>
<wsdl:output xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
message="ns:returnExternalClassResponseMessage"
wsaw:Action="urn:returnExternalClass"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestingSOAP11Binding" type="ns:TestingPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<wsdl:operation name="returnExternalClass">
<soap:operation soapAction="urn:returnExternalClass"
style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TestingSOAP12Binding" type="ns:TestingPortType">
<soap12:binding
transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="returnExternalClass">
<soap12:operation soapAction="urn:returnExternalClass"
style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Testing">
<wsdl:port name="TestingSOAP11port" binding="ns:TestingSOAP11Binding">
<soap:address
location="http://localhost:8080/axis2/services/Testing"/>
</wsdl:port>
<wsdl:port name="TestingSOAP12port" binding="ns:TestingSOAP12Binding">
<soap12:address
location="http://localhost:8080/axis2/services/Testing"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
It seems to be a good WSDL, so I've run again the "AXis 2 code
generator" Eclipse plugin to generate server code from that WSDL. That
plugin generates this files :
code.ExtensionMapper.java
code.ExternalClass.java
code.ExternalClass2.java
code.InternalClass.java
code.InternalClass3.java
code.ReturnExternalClassResponse.java
code.TestingMessageReceiverInOut.java
code.TestingSkeleton.java
build.xml
resources\Testing.xml
So, I fill in the bussiness logic in the TestingSkeleton file :
package code;
/**
* TestingSkeleton java skeleton for the axisService
*/
public class TestingSkeleton {
/**
* Auto generated method signature
*
*
*/
public code.ReturnExternalClassResponse returnExternalClass( ) {
return null;
}
}
Then I've run the "Axis 2 Service Archiver" Eclipse plugin to deploy
de web service, choosing the right classes directory of my Eclipse
project, "Skip WSDL" option, no external libraries selected and the
"Generate the service xml automatically" option, the i push the "Next"
button and nothing happens at all, i can't see the next plugin screen
but no errors are reported... grrrrrrr!!!!!!...
Please, help, I'm very stuck with this, and need help... I really
like the nice Axis 2 architecture and want to move on from Axis 1 to
Axis 2, but I can't find the way. I'll be very pleased if anybody
could help or at least could tell me where could i find a working
example similar to what i'm trying to do... a good book about Axis
2... anything!!. Thanks in advance.
2007/7/17, albert quinn <[EMAIL PROTECTED]>:
Hi David !! :
First of all, many thanks for spending your time with my newbie (and
probably obvious questions for an advanced user) questions, but I've
just come to the Axis World and I'm totally lost and needing lots of
help after reading the Axis 2 docs.
Second... I think I've not explained my problem very well, so I'll
try again : I've read the Axis 2 docs. I've probed the POJO samples
and then I've started to try things to check if a POJO web service
could do all I need. So I've tried this :
I've this two classes :
package code;
public class ExternalClass {
private boolean error = false;
private String message = null;
private InternalClass internalClass = null;
public ExternalClass(boolean error, String message, InternalClass
internalClass) {
this.error = error;
this.message = message;
this.internalClass = internalClass;
}
// getters and setters...
}
package code;
public class InternalClass {
private String internalMessage = null;
public InternalClass(String internalMessage) {
this.internalMessage = internalMessage;
}
// get and set methods.
}
Then I've this web service :
package code;
public class WebServiceTest {
public ExternalClass returnExternalClass() {
return new ExternalClass(true, "external message", new
InternalClass("internal message") );
}
}
Then I've deployed that POJO web service using the "Axis 2 Service
archiver" Eclipse plugin and then I've done this RPC client :
package code;
// import sentences
public class WebServiceTestClient {
public static void main(String[] args) {
try {
RPCServiceClient rpcClient = new RPCServiceClient();
Options oOptions = rpcClient.getOptions();
EndpointReference epr = new
EndpointReference("http://localhost:8080/axis2/services/WebServiceTest/returnExternalClass");
oOptions.setTo(epr);
QName op = new QName("http://code/xsd", "returnExternalClass");
Object[] arguments = new Object[] { };
Class[] returnTypes = new Class[] { ExternalClass.class };
Object[] response = rpcClient.invokeBlocking(op, arguments,
returnTypes);
ExternalClass externalClass = (ExternalClass) response[0];
if(externalClass == null)
System.out.println("ExternalClass == NULL");
else {
System.out.println("error : " +
externalClass.isError() );
System.out.println("external message : " +
externalClass.getMessage() );
InternalClass internalClass =
externalClass.getInternalClass();
if(internalClass == null)
System.out.println("InternalClass = NULL");
else
System.out.println("internal message : " +
internalClass.getInternalMessage() );
}
} catch (AxisFault oAxisFault) {
System.out.println("ERROR !!!!! Fault.");
oAxisFault.printStackTrace();
} catch(Exception oException) {
System.out.println("ERROR !!!!! Excepction.");
oException.printStackTrace();
}
}
}
Then I've run the client and I've got this Exception :
ERROR !!!!! Fault.
org.apache.axis2.AxisFault: Exception occurred while trying to invoke
service method returnExternalClass
at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:373)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
at
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:97)
at code.WebServiceTestClient.main(WebServiceTestClient.java:23)
So, the question is : can a POJO web service return something like
that? If so... any idea about what is happening here?. If not...
should I use ADB (I've read on Axis docs that ADB has problems with
complex types), XmlBeans?
Thanks again in advance to anybody who help me !!!. Regards.
2007/7/17, david <[EMAIL PROTECTED]>:
> Hello Albert, the POJO samples are RPC based services with clients that
appear to work as expected once the service is uploaded to the AXIS2 web app. HTH,
David.
>
> albert quinn wrote ..
> > Hi !!
> >
> > A yes or not question : I want a POJO Web Service returning my own
> > objects from its methods, is that possible or have I to use any of the
> > Axis 2 databinding frameworks?
> >
> > Thanks in advance to anybody who help me!!.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]