JAX-WS Validation - weblogic.developer.interest.webservices.general(Archived)

Is there a property or configuration that can be set to validate SOAP requests in JAX-WS? We've noticed in WL 10 MP1 that SOAP requests are still delivered to our JAX-WS implementation when required elements are missing (elements with minOccurs=1 in the XML schema for the request). 

I think this problem is related to JAX-WS specs and not weblogic, however I think you will have to do the validation yourself there is no way to do that in JAX-WS 2.0 

You can find that this issue is fixed in JAX-WS 2.1.3. fo doc\lit
You can follow this URL
https://jax-ws.dev.java.net/issues/show_bug.cgi?id=239

Related

no wsdl validation

We are developing a web service using top-down approach and we have authored our wsdl file as well as referenced xsd schemas. In our build process we use wsdlc ant task to generate classes and then we filled in implementation details. Then we run jwsc task to create our war file for deployment. War file is generated and we can deploy the service on wl 9.2.
1. When we invoke the webservice with invalid request data that should fail wsdl validation it happily passes through to our implementation code. It looks that none of the restrictions we specified in our wsdl and xsd files are being applied. What are we missing here?
2. We have checked that we followed what is outlined in http://e-docs.bea.com/wls/docs92/webserv/use_cases.html#wp220705
3. We have also followed instructions on publishing the static (golden) wsdl from http://e-docs.bea.com/wls/docs81/webserv/webxml.html
with no success.
4. When I observe the wsdl that is deployed it has clearly been modified by weblogic, we tried to prevent this by following the steps outlined in the above link, but it stil modifies it, could this be causing no validation problem?
5. We scanned the net for anybody who had this problem of request not being validated against wsdl and could not find anything useful.
Any help or ideas would be greatly appreciated. 
As far as I can tell, there are no Java web service implementations that generate code to perform schema validation on SOAP requests. Certainly WLS does not. The wsdlc tool, for example, doesn't generate Java code that implements XML Schema simpleType restrictions. It is up to you, as the web service implementor, to code your web service so that it conforms to the API you advertise in its WSDL.
In this model the WSDL is primarily intended for service clients as the contract for what you, as service provider, will deliver. When you define an operation that returns a simpleType value, you are telling clients that the response value will conform to any restrictions of that simpleType. It is up to your WebMethod implementation to ensure this. Similarly simpleTypes can be used to instruct clients as to the input values they may send on requests. And again, it is up to you to enforce those restrictions in your WebMethod implementation.
All the Java application server products out there seem to generate similar, fairly straightforward, code in their "start from WSDL" tools and then leave it to the web service implementor to add whatever validation code they require. At runtime many of these products don't even have access to the original WSDL, but generate WSDL dynamically, if required (i.e. via "?WSDL").
I did find an old (2003) MSDN article about adding XML Schema validation at runtime via a SOAPExtension class. But again, these extension classes weren't generated, but needed to be authored by the web service developer. There's nothing more recent, so it doesn't look like this framework caught on with .NET developers.
Would this feature be useful? Sure, but it's a very hard problem that no one has solved or, it appears, is actively trying to.
-Alan 
I believe amullend misunderstood the post.
There are two types of validation that are possible from a Web Service provider's implementation:
1. Contract validation of a SOAP request based upon included Schema and WSDL definitions
2. Additional, lower level validation performed through Java programmatic constructs (such things as business rules, or even more fine-grained data definition rules that were/could not be defined as part of the Service spec)
Item number 1 is part of an operating Web Service implementation on any J2EE Application Container. The Container is responsible for early validation stages of request processing, utilizing the Service definitions. A container does not simply provide a WSDL file as a convenience to consumer provisioning (as opposed to distributing it through other channels), but requires it for validation of inbound/outbound SOAP messages. A web service is not a simple web application with a WSDL file. A Web Service is an XML-enabled application that adheres to strict definitions. It is part of building any JSR-921 compliant application. A container that did not implement this validation logic would simply be providing a platform for a Web application.
All J2EE application containers that are used to build JSR-921 compliant applications, include a SOAP Processor that parses and validates a SOAP request that is submitted. It is part of the respsonsibility of the SOAP processor upon recieving a Service request. If valid, the SOAP Processor relays the request to the appropriate Service method.
If the SOAP processor did not provide these validating capabilities, it is true a developer could simply validate their own (more appropriate to document style though) via accepting the formal request and validating it at the programmatic level using the included XML Schemas and any XML parser. But this is non-standard :-) and why would they anyway? It is redundant and common behaviour that should be handled at the Service layer by the SOAP processor contained within the Container.
Validation capabilities are provided by other vendor products such as Oracle AS and WebSphere. If BEA did not provide the capability, it would seem strange. 
We are developing a web service using top-down
approach and we have authored our wsdl file as well
as referenced xsd schemas. In our build process we
use wsdlc ant task to generate classes and then we
filled in implementation details. Then we run jwsc
task to create our war file for deployment. War file
is generated and we can deploy the service on wl
9.2.
1. When we invoke the webservice with invalid request
data that should fail wsdl validation it happily
passes through to our implementation code. It looks
that none of the restrictions we specified in our
wsdl and xsd files are being applied. What are we
missing here?
2. We have checked that we followed what is outlined
in
http://e-docs.bea.com/wls/docs92/webserv/use_cases.htm
l#wp220705
3. We have also followed instructions on publishing
the static (golden) wsdl from
http://e-docs.bea.com/wls/docs81/webserv/webxml.html
with no success.
4. When I observe the wsdl that is deployed it has
clearly been modified by weblogic, we tried to
prevent this by following the steps outlined in the
above link, but it stil modifies it, could this be
causing no validation problem?
5. We scanned the net for anybody who had this
problem of request not being validated against wsdl
and could not find anything useful.
Any help or ideas would be greatly appreciated.On the client side, you can validate the response message with
((javax.xml.rpc.Stub) port)._setProperty(weblogic.wsee.jaxrpc.WLStub.VALIDATE_WEBSERVICE_RESPONSE, "true");
If you want to validate the incoming SOAP message at server-side.
You can enable it by edit weblogic-webservices.xml, e.g.
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-webservices xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<webservice-description>
<webservice-description-name>validation.serverside.SimpleImpl</webservice-description-name>
<port-component>
<port-component-name>SimpleSoapPort</port-component-name>
<service-endpoint-address>
<webservice-contextpath>SimpleSchemaServerValidation</webservice-contextpath>
<webservice-serviceuri>/SimpleEchoService</webservice-serviceuri>
</service-endpoint-address>
<validate-request>true</validate-request>
</port-component>
</webservice-description>
</weblogic-webservices>
We don't support validation on all the outbound message, that is the responsibility of your business code. 
The problem is an actual bug with WL 9.2 MP0. The solution proposed by jliao is correct, but it will only work with the correct fixpack; there is an alternate way of performing validation at the container level as well, see link). The issue has been resolved with WL 9.2 MP1 and relates to CR082116. Details can be found at the following link:
http://e-docs.bea.com/wls/docs92/issues/known_resolved.html#wp1180999 
hi
we generate the war file with an ant-script from a wsdl file and an implementation.
is there a way that the jwsc or jws generates this "<validate-request>true</validate-request>" in the weblogic-webservice.xml automaticaly?
thanks for help 
Couldn't see a way through an Ant or Bea supplied task to do it, so we created a duplicate deployment descriptor with the setting and replaced the generated deployment descriptor as part of our build process.
As a side note, it doesn't appear to work anyway :-)
After verifying on WL 9.2 MP0, MP1, and MP2, it seems to work to a degree on MP0 but not at all on MP1 or MP2 (before you ask, this is counter to what was stated in their bug fix). Even on MP0 it does not work completely as only partial validation is performed and it is not consistent. Regardless of what is stated by BEA, request validation does not appear to be a capability offered by their 9.2 release (not sure if it works in any release). We have opened a defect with BEA but there has been little to no responses on it.
As a side comment, the same capability is achievable through your own XML parser use or via Spring Web Services Interceptors. However, other vendors provide this capability through their SOAP Processor and it is functional.

Attachments with Webservices - weblogic 9.2

Is there a standard stack available for sending attachments with SOAP ? I guess SAAJ 1.2 is partially supported by weblogic. But does this require any changes to WSDL ? SWA and SAW ref implementations as indicated in the JAX-RPC specification is resulting in errors during web service generation from WSDL
I would like to attach a WAV file to the SOAP request and invoke the web service. I would like to know the best possible way to acheive this in the 9.2 platform. Also let me know whether the service packs have resolved certain issues in this area

WS-Addressing annotation not working in WLS 10.3

We are using JAX-WS to generate our web services. When I am adding WS-Addressing annotation as #Addressing(enabled=true, required=true) to my WebService I am not seeing any difference in the app server(WLS 10.3) generated WSDL. The ear deploys fine and works as if the WS-Addressing is not enabled. What am I doing wrong?
Any help is appreciated.
Thanks,
Prantor 
Prantor,
Most likely you're doing nothing wrong. The JAX-WS 2.1 specification, which WLS 10.3 implements, does not provide any support for WS-Addressing metadata in WSDL. The W3C recommendation that governs this, WS-Addressing Metadata 1.0 was approved after JAX-WS 2.1 was completed. It's targeted for the next version of JAX-WS.
Including the #Addressing annotation in your web service will cause WS-Addressing support to be activated. WS-A headers in the SOAP Request should be correctly processed.
To see if it's working, you'll need to create a client that includes WS-Addressing headers and send it to your service. For example, you could set the ReplyTo header to an endpoint and verify that WLS sends the SOAPResponse to that location.
-Alan

oepe(Juno) deploy JAX-RPC

Have a strange issue deploying from oepe(Eclipse-Juno) a simple WebService with JAX-RPC prog. model.
Greatly appreciated if someone could relate or if there is a clear example.
First, my understanding is that from OEPE itself with recent versions like Juno, there is no command to generate JAX-RPC. The default is JAX-WS with no alternative! (I am talking about WebLogic WS->Generate Web Service from wsdl)
As a result i generated the ant script running JAXWS and in resulted wsdlc task i changed the type from JAXWS to JAXRPC.
All went fairly well, produced a jar file with compiled wsdl arifacts, which i placed in WEB-INF/lib.
There was a minor "glitch" for portName, which was different from default. If specified only in #WLHttpTransport the default name is assumed at deploy, which fails. I needed to duplicate portName in #WebService.
With this minor change i can deploy(right-click and Add to Server) access wsdl and test client... However when an operation is invoked from test client the wrapper parameter has all values null!
I guess main question is: from OEPE could we deploy and run JAX-RPC... I saw an elaborate example based on ant file which specifies JAX-RPC option in a couple of places, but my intention was to run all from eclipse same as JAX-WS runs...
thanks 
Hi Stelaro,
It depends which weblogic version you are using for run-time configuration while creating a project.
If you are using wls 10.3.3 and above then definitely it will not support.
So let me know which version you are using.
Regards,
Kal 
OEPE only supports jax-ws web service. There is no facet for jax-rpc
it does not mater with wls version. It only creates JAX-WS web service
JDeveloper supports both jax-rpc and jax-ws
Regards,
Sunil P 
im out of luck:
WLS_PRODUCT_VERSION=10.3.6.0
thanks very much for reply.

OSB Business Services / ejb transport / Java Enumeration

Hi, I am working with OSB 11.1.1.4 (wls 10.3.4) in order to generate business service from existing ejb 3.0. Everything was working fine until I tried to add an ejb method which received as a parameter a class which contains an Enumeration attribute. I got an error Enum types are not supported in jws. According to jax ws enums are supported on latest versions, this is not supported but for jahx rpc. I read a lot of documentation the past 2 days and appeaars to be a configuration error but I haven't be able to determine where to specify that sbconsole or eclipse used always jax ws instead of jax rpc. I work around that I found was disabling weblogic web service validator but I could find how todo that. Someone knows if this is an issue for weblogic 11g R3? This can be solved by using wls 10.3.6? Any help will be appreciated. Thanks in advanced.

Categories

Resources