on 05-29-2007 12:33 PM
Hi,
we are developing a web dynpro application using web services as backend and chose the adaptive web service model as client framework.
Recently I ran into some major drawbacks and would like to here your opinion. At the moment Im not sure if we shouldnt change to some client framework like axis and use java bean model instead.
The problems we discovered:
Problems with setting null to primitive types
In a complex type used in wsdl, a double attribute may be null. The model generates this attribute as double object (good - because double java type can not be null), but setting null to this attribute causes an exception:
com.sap.tc.webdynpro.model.webservice.base.exception.BaseModelRuntimeException: Must not assign null to primitive type 'double' of attribute ' someAttribute' in model class ' Complex'
The wsdl looks like this:
<xsd:complexType name="Complex">
<xsd:element minOccurs="0" name="someAttribute" nillable="true" type="xsd:double">
</xsd:complexType>
No support of web service exceptions!
If I create a Java implementation of a web service which throws checked exceptions in its methods, the WSDL is generated accordingly.
A client framework like Axis generates client methods that throw such exceptions. The adaptive web service model doesnt. The fault part of an message in wsdl is generated in the model classes but never filled after an error occurred. Can I retrieve the checked exception and its data somehow?
This is essential for our project!
Did I get something wrong? Are there commons solutions?
Best regards
Dominik
Dominik,
About first issue: this sounds like a bug. Try to submit your bug report.
Second problem: if I understand correctly, the general code pattern is:
try {
ws.execute();
} catch (final CMIException cmiException) {
...
}
Did you try to check cmiException.getCause() ?
Valery Silaev
SaM Solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Dominik,
>
> About first issue: this sounds like a bug. Try to
> submit your bug report.
>
> Second problem: if I understand correctly, the
> general code pattern is:
>
> try {
> ws.execute();
> catch (final CMIException cmiException) {
> ...
>
>
>
> Did you try to check cmiException.getCause() ?
>
> Valery Silaev
> SaM Solutions
> http://www.sam-solutions.net
Yes I did. At the end of the cause chain theres a general exception (something like GeneralSoapFault). The message of this exception contains the full qualified name of my exception from the backend and the message.
But I can't find the checked exception. Properties are lost.
If I turn on the log and check the response I can see the xml contains the exception.
Both problems still exist, but I got a workaround for the exception problem:
If the exception is a checked (business) exception the cause for the CMIException is of type InvocationTargetException.
See the following code:
if (e.getCause() instanceof InvocationTargetException) {
WebServiceException e2 = (WebServiceException) ((InvocationTargetException)e.getCause()).getTargetException();
MyException myException = (MyException)e2.getContent();
}
The problem with double still exists, but BigDecimal works
Message was edited by:
Dominik H
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can confirm i had issues implementing webservices using webdynpro (in devstudio 2.0.14). The email example in the help works fine, but that is the only time i could see it working. I tried it with a number of publicly available webservices like amazon, but i got null pointers everywhere. I am not sure how newer versions of webdynpro behave, but it could be worth trying to use the most up-to-date version.
Another solution would be to create a compile/runtime DC using the apache xmlrpc libraries. This doesnt use the webdynpro model generation utilities. but still lets you use webdynpro.
if you wanted to use axis to generate classes the you couls similarly bundle up the libraries that the generated classes need into a seperate compile/runtime DC and just copy in the generated classes to you project or make another seperate DC with a public part to share them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Robert,
From <a href="/people/bertram.ganz/blog/2007/05/25/new-web-dynpro-java-learning-material--using-adaptive-web-service-models">New Web Dynpro Java Learning Material - Using Adaptive Web Service Models</a>:
<i>The presented Web Dynpro Java sample applications all leverage the successor of the former Web Service model named Adaptive Web Service Model <u>which is available starting with SAP NetWeaver 04 SP Stack 17 and SAP NetWeaver 7.0 SP Stack 6</u>.</i>
So version 2.0.14 is not supported.
VS
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.