aspose file tools*
The moose likes Web Services and the fly likes JSP as webservice client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JSP as webservice client" Watch "JSP as webservice client" New topic
Author

JSP as webservice client

vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
how to develop the jsp as the webservice client.

What is the value of the namespace uri.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
You can embed a WS client written in Java in a JSP page as a scriptlet, just like you would embed any other kind of Java code. Having any amount of Java code -and certainly a WS client- in a JSP page is considered bad design, though. Have you thought about putting the WS client in a servlet, from which you then forward to a JSP page?

Introduction to XML namespaces can be found here and here.


Ping & DNS - my free Android networking tools app
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
is it need to the stubs and ServiceLocator generated wsdl2java to be present at the client's classpath
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
Yes, those classes need to be in the client classpath. In the case of a JSP or servlet client that would be in the WEB-INF/classes or lib directory.
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
org.xml.sax.SAXException: Deserializing parameter 'Return': could not find deserializer for type 'Message'
though i'm having the Bean in the classpath it's giving the error.
what is the solution to this problem
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
I'm monitoring req/res using TCP monitor.

The req is going proper.
and in the values are coming proper.but i am having one complexType element definition.that is not getting deserialized.

The elements are under with requestelementName+Return.

why this is happning/
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
How did you specify on the client side which class to use for deserialization? Just making the class available is not sufficient, you need to specify the mapping explicitly.
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
i have given the type mapping in the server-config.wsdd file .is it

mapping.xml file needed
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
server-config.wsdd configures the server, which, as you were saying, serializes the object OK. How do you configure the client, which throws the exception?
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
clinet-config.wsdd file.
is it must?

the contents are same as server-config.wsdd file
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
what is the location it has to reside?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
The client config can't be the same as the server config - the server file has WS deployment information that are not applicable to the client. Why don't you post the two files -don't forget to use CODE tags-, and we can take a look at them to see if there's something missing.

And -yes- the client config file is a must if you want to declare custom serialization. How do you use/specify it during invocation of the client?
[ January 09, 2006: Message edited by: Ulf Dittmer ]
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
same content i kept in client-config.wsdd
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
A service element is only relevant for the server; it is ignored on the client. You need just the "typeMapping" element. If you're using the BeanSerializer, you could actually use the simpler "beanMapping" element instead. All the details are described in the Axis data mapping documentation.

Also, I don't see any mapping for the type 'Message' which the error message complains about.
[ January 10, 2006: Message edited by: Ulf Dittmer ]
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
my cutom type is complex Type,Then do i need to provide type mapping for sub types also
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
Yes, of course. Even if the subtypes use the BeanSerializer as well, that needs to be declared in the config file.
vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
Even if the subelements are type of xsd:string?

And The Bean class is getSerializer() and getDeserializer().
Do i need to registerTypeMapping in the client explicitly
[ January 11, 2006: Message edited by: kumar sanu ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
Even if the subelements are type of xsd:string?


No, Axis knows what to do with strings.

And The Bean class is getSerializer() and getDeserializer().


I don't know what this means.

Do i need to register TypeMapping in the client explicitly


To repeat: any type mapping that goes beyond the standard types needs to be registered; see the link I posted earlier.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP as webservice client