The Artima Developer Community
Sponsored Link

Web Services Forum
Help with Axis

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Marius

Posts: 1
Nickname: burzumel
Registered: Apr, 2005

Help with Axis Posted: Apr 24, 2005 6:07 AM
Reply to this message Reply
Advertisement
Hi.
I'm quite a newbie to Axis and Web Services and I'm stuck with the following problem :
I need to create a simple Web service called Book which will have 2 methods :
public BookDto getBook(Integer id);
public boolean updateBookInteger id, BookDto newBook);

where BookDto is a DTO, serializable class and written conforming to the Java Beans specifications : it contains
private java.lang.Integer id;
private java.lang.String title;
a default (non-arg) constructor and getter&setter methods.

I used the tool Java2WSDL like this :

java org.apache.axis.wsdl.Java2WSDL -o book.wsdl -l"http://localhost:8080/axis/services/Book" -n "urn:Book" -p"book" "urn:Book" book.IBook

and the book.wsdl file was generated.

Then, I used the tool WSDL2Java like this :

java org.apache.axis.wsdl.WSDL2Java -o . -d Session -s -S true -Nurn:Book book book.wsdl

and the java files, deploy.wsdd & undeploy.wsdd were created.

I implemented the methods in the BookSoapBindingImpl class as needed.
Then, the implementation of the BookDto class was modified, the following code being added by the WSDL2Java tool :

=========================================
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(BookDto.class, true);

static {
typeDesc.setXmlType(new javax.xml.namespace.QName("urn:Book", "BookDto"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("id");
elemFi eld.setXmlName(new javax.xml.namespace.QName("", "id"));
elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemFie ld = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("title");
ele mField.setXmlName(new javax.xml.namespace.QName("", "title"));
elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}

/ **
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}

/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}

/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
=============================================

After having compiled all these classes I deployed the Web Service (setting the java:RPC provider) and all the tests worked fine.
BUT, I have to create my custom provider, named java:JWSFL (I am creating a framework for some basic web service orchestration) and I need to use it. So, in the deploy.wsdd file I specified provider="java:JWSFL" and redeployed the web service.
But, when running the tests again, I got the following error :
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: Deserializing parameter 'in1': could not find deserializer for type {urn:Book}BookDto
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:makshe

I must mention that the getBook method works, so I am able to receive a BookDto, but I can't invoke the updateBook (which must send a BookDto class).

In the client I registered it like this :

QName qn = new QName("urn:Book", "BookDto" );
call.registerTypeMapping(UserDto.class, qn, // *3*
new org.apache.axis.encoding.ser.BeanSerializerFactory
(BookDto.class, qn),
new org.apache.axis.encoding.ser.BeanDeserializerFactory
(BookDto.class, qn));
call.addParameter("in0", XMLType.XSD_INTEGER, ParameterMode.IN);
call.addParameter("in1", qn, ParameterMode.IN);

Also, in the deploy.wsdd there is this mapping :

<typeMapping
xmlns:ns="urn:Book"
qname="ns:BookDto"
type="java:book.BookD to"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer ="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle="http://sc hemas.xmlsoap.org/soap/encoding/"
/>


Please help me!!!
Thank you.

Topic: How to deploy axis in Tomcat? Previous Topic   Next Topic Topic: Axis deserialising problem

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use