Hi, I'm fairly
new to Axis, but I pretty much have it working or at least I can see (in the
eclipse debugger) a message move from my client to the server which is also
being debugged in Eclipse v3.1 jvm = 1.4.2 Tomcat version is 5.0
Axis2 v0.95
The issue I'm having
is an operation is changing from what is set on the client and sent to the
server and what the server perceives the as operation
requested.
I have a java class
which contains 3 methods which are exposed as web services. They are
placed onto the operation array as follows
[0]
Record
[1]
RetrieveUnique
[2]
RetriveCollection
This class could be
something as simple as
FoundationServicesServer
{
public String Record(String arg1, String arg2)
{
String
whereAmI + this.getClass().getName() + ".Record()";
String msg =
whereAmI;
msg += arg1
+ " arg2 is " + arg2;
System.out.println(msg);
return
msg;
}
public String RetriveUnique(String arg1, String arg2)
{
String
whereAmI + this.getClass().getName() + ".RetriveUnique()";
String msg =
whereAmI;
msg += arg1
+ " arg2 is " + arg2;
System.out.println(msg);
return
msg;
}
public String RetrieveCollection(String arg1, String arg2)
{
String
whereAmI + this.getClass().getName() +
".RetrieveCollection()";
String msg =
whereAmI;
msg += arg1
+ " arg2 is " + arg2;
System.out.println(msg);
return
msg;
}
}
In my client code
the RetrieveUnique operation is requested via the following
code:
FoundationServicesServerStub stub =
null;
try
{
RetrieveUnique retProto = new RetrieveUnique();
retProto.setClassType(prototype.getClass().getName());
retProto.setFBaseXMLString(prototype.toString());
RetrieveUniqueResponse resp = null;
stub = new FoundationServicesServerStub();
resp = stub.retrieveUnique(retProto);
log.info(resp.toString());
}
catch (Exception e)
{
String msg = whereAmI;
msg += " Exception encountered of type " + e.getClass().getName() + " with a msg of " + e.getMessage();
log.info(msg);
throw new IssueEncounteredException(msg);
}
finally
{
}
The RetrieveUnique class which was generated by WSDL2Java is as follows:
try
{
RetrieveUnique retProto = new RetrieveUnique();
retProto.setClassType(prototype.getClass().getName());
retProto.setFBaseXMLString(prototype.toString());
RetrieveUniqueResponse resp = null;
stub = new FoundationServicesServerStub();
resp = stub.retrieveUnique(retProto);
log.info(resp.toString());
}
catch (Exception e)
{
String msg = whereAmI;
msg += " Exception encountered of type " + e.getClass().getName() + " with a msg of " + e.getMessage();
log.info(msg);
throw new IssueEncounteredException(msg);
}
finally
{
}
The RetrieveUnique class which was generated by WSDL2Java is as follows:
/**
* RetrieveUnique.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: #axisVersion# #today#
*/
* RetrieveUnique.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: #axisVersion# #today#
*/
package
com.thomson.west.foundations.server;
/**
* RetrieveUnique bean class
*/
/**
* RetrieveUnique bean class
*/
public class
RetrieveUnique
implements org.apache.axis2.databinding.ADBBean{
public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://server.foundations.west.thomson.com",
"retrieveUnique",
"ns1");
/**
* field for ClassType
*/
protected java.lang.String localClassType ;
/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getClassType(){
return localClassType;
}
/**
* Auto generated setter method
* @param param ClassType
*/
public void setClassType(java.lang.String param){
this.localClassType=param;
}
/**
* field for FBaseXMLString
*/
protected java.lang.String localFBaseXMLString ;
/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getFBaseXMLString(){
return localFBaseXMLString;
}
/**
* Auto generated setter method
* @param param FBaseXMLString
*/
public void setFBaseXMLString(java.lang.String param){
this.localFBaseXMLString=param;
}
/**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName){
java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList();
elementList.add(new javax.xml.namespace.QName("",
"classType"));
elementList.add(localClassType==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localClassType));
elementList.add(new javax.xml.namespace.QName("",
"fBaseXMLString"));
elementList.add(localFBaseXMLString==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localFBaseXMLString));
return org.apache.axis2.databinding.utils.ADBPullParser.createPullParser(qName, elementList.toArray(), attribList.toArray());
}
/**
* utility method to http://www.w3.org/2001/XMLSchema-instance
*/
/**
* Factory class that keeps the parse method
*/
public static class Factory{
/**
* static method to create the object
*/
public static RetrieveUnique parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
RetrieveUnique object = new RetrieveUnique();
try {
int event = reader.getEventType();
//event better be a START_ELEMENT. if not we should go up to the start element here
while (event!= javax.xml.stream.XMLStreamReader.START_ELEMENT) {
event = reader.next();
}
if (!MY_QNAME.equals(reader.getName())){
throw new Exception("Wrong QName");
}
org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine stateMachine1
= new org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine();
javax.xml.namespace.QName startQname1 = new javax.xml.namespace.QName(
"",
"classType");
stateMachine1.setElementNameToTest(startQname1);
stateMachine1.setNillable();
stateMachine1.read(reader);
object.setClassType(
stateMachine1.getText()==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertTostring(
stateMachine1.getText()));
// Move to a start element
event = reader.getEventType();
while (event!= javax.xml.stream.XMLStreamReader.START_ELEMENT) {
event = reader.next();
}
org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine stateMachine2
= new org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine();
javax.xml.namespace.QName startQname2 = new javax.xml.namespace.QName(
"",
"fBaseXMLString");
stateMachine2.setElementNameToTest(startQname2);
stateMachine2.setNillable();
stateMachine2.read(reader);
object.setFBaseXMLString(
stateMachine2.getText()==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertTostring(
stateMachine2.getText()));
} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}//end of factory class
}
implements org.apache.axis2.databinding.ADBBean{
public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://server.foundations.west.thomson.com",
"retrieveUnique",
"ns1");
/**
* field for ClassType
*/
protected java.lang.String localClassType ;
/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getClassType(){
return localClassType;
}
/**
* Auto generated setter method
* @param param ClassType
*/
public void setClassType(java.lang.String param){
this.localClassType=param;
}
/**
* field for FBaseXMLString
*/
protected java.lang.String localFBaseXMLString ;
/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getFBaseXMLString(){
return localFBaseXMLString;
}
/**
* Auto generated setter method
* @param param FBaseXMLString
*/
public void setFBaseXMLString(java.lang.String param){
this.localFBaseXMLString=param;
}
/**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName){
java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList();
elementList.add(new javax.xml.namespace.QName("",
"classType"));
elementList.add(localClassType==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localClassType));
elementList.add(new javax.xml.namespace.QName("",
"fBaseXMLString"));
elementList.add(localFBaseXMLString==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localFBaseXMLString));
return org.apache.axis2.databinding.utils.ADBPullParser.createPullParser(qName, elementList.toArray(), attribList.toArray());
}
/**
* utility method to http://www.w3.org/2001/XMLSchema-instance
*/
/**
* Factory class that keeps the parse method
*/
public static class Factory{
/**
* static method to create the object
*/
public static RetrieveUnique parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
RetrieveUnique object = new RetrieveUnique();
try {
int event = reader.getEventType();
//event better be a START_ELEMENT. if not we should go up to the start element here
while (event!= javax.xml.stream.XMLStreamReader.START_ELEMENT) {
event = reader.next();
}
if (!MY_QNAME.equals(reader.getName())){
throw new Exception("Wrong QName");
}
org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine stateMachine1
= new org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine();
javax.xml.namespace.QName startQname1 = new javax.xml.namespace.QName(
"",
"classType");
stateMachine1.setElementNameToTest(startQname1);
stateMachine1.setNillable();
stateMachine1.read(reader);
object.setClassType(
stateMachine1.getText()==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertTostring(
stateMachine1.getText()));
// Move to a start element
event = reader.getEventType();
while (event!= javax.xml.stream.XMLStreamReader.START_ELEMENT) {
event = reader.next();
}
org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine stateMachine2
= new org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine();
javax.xml.namespace.QName startQname2 = new javax.xml.namespace.QName(
"",
"fBaseXMLString");
stateMachine2.setElementNameToTest(startQname2);
stateMachine2.setNillable();
stateMachine2.read(reader);
object.setFBaseXMLString(
stateMachine2.getText()==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertTostring(
stateMachine2.getText()));
} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}//end of factory class
}
When I view the
_messageContext.axisOperation.name is "retrieveUnique" prior to the
_operationClient.execute() call in the generated Stub as it should
be.
When the request is
viewed in the FoundationServicesServerMessageReceiverInOut (generated by
WSDL2Java) I can view the
msgContext.getOperationContext().getAxisOperation().name is set now set to
retieveCollect.
This is very odd and
I'm wondering if there is a bug in my code (more then likely) or if this is a
bug that I've not found looking around on the internet regarding Axis2
v0.95.
Anyone else having
this issue?
Thanks for any feed
back you can offer
Dave Ziebol