How to pass XMLOptions to Clientgen - weblogic.developer.interest.webservices.general(Archived)

I need some help with the webservice clientgen ant task. I am using weblogic version 9.2 MP3.
Unfortunately, the WSDL I have (from a 3rd party, can't change it), is non comformant to the unique particle attribution constraint. I am able to compile it using glassfish, but I need to run my client in a web logic server, so I would need/prefer to use the native weblogic webservice constructs.
Whereas glassfish throws a warning for the non-comformant parts, Web Logic's client gen simply errors out and exits...
With this in mind, I am trying to tell clientgen to disable the upa check. Can this be done? How can we pass it that option?
Thx.
FYI: here's the error:
[clientgen] ClientGen Build Failed : com.bea.xml.XmlException: C:\bea\user_projects\w4WP_workspaces\lantern_project\ApcWebLogicTest\wsdl\apc-northbound.xsd:19:9: error: cos-nonambig: Content model violates the unique particle attribution rule.

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.

Weblogic 9.2, Clientgen and typeMappingFile - where has it gone?

In WL 8.1, the clientgen ant task had a typeMappingFile parameter which allowed you to generate a webservice client which called a webservice using custom parameters (e.g. XMLBeans) by specifying a Codec class which did the necessary marshalling.
Weblogic 9.2 doesn't have this parameter. Has this behaviour been removed? If so why? and also any idea how I can create a webservice client that uses XMLBeans rather than the generated RPC objects? 
I have the same question. Can someone answer this please? It's a bit perplexing since the jwsc task seems to do this automagically (generate a Web Service with proper XMLBeans/WSDL type mappings given XMLBean parameters in the Web Method). Or am I just confused? 
It is possible to create a web service client in weblogic workshop 9.2 by creating a web services project and selecting the xmlbeans builder facet (excluded by default). Put the WSDL and any included xsd files in the schemas directory. The xml beans get built automatically.
Generate a service control from the WSDL (right click on the WSDL and select web services and generate service control).
Create a client class and insert the service control by right clicking in the source of your class and selecting insert control. You should then be able to use code completion to navigate the available types and methods. 
Well, it is possible to do and uses a parameter to clientgen that was missed out of the documentation (apparently it will be in future revisions).
The parameter to pass to clientGen is typeFamily which should be set to XMLBEANS_APACHE.
e.g.
<clientgen
wsdl="SimpleClientImplService.wsdl"
destDir="${clientclasses.dir}"
JaxRPCWrappedArrayStyle="false"
typeFamily="XMLBEANS_APACHE"
packageName="some.package.here">
</clientgen>
Hope that helps.

wsdl2service/package Service has problems with clientgen.

I am putting together a webservice and client, both based on a supplied
WSDL. (We need to have a service that does the same operations as those on a
server elsewhere that uses the WSDL, and the client talks to the "service
elsewhere")
I'm creating the service with Ant by using:
wsdl2service from the given WSDL
compiling my ServiceImpl and
wspackage
When the client tries to contact the local service (the first test is to see
if I can talk to myself :), the response is a Fault, including:
<faultstring>Exception during processing:
weblogic.xml.schema.binding.DeserializationException: mapping lookup failure
for xml type ['http://www.inventuresolutions.com']:Interchange and java
interface javax.xml.soap.SOAPElement (see Fault Detail for
stacktrace)</faultstring>
1. I notice that the generated client includes a group of classes and and
xxxCodec classes that aren't in the packaged service. Should they be (to
allow the ServiceImpl to turn the SoapElement back into a Java object)?
2. The WSDL we are using has two "import namespace="..."" Elements in its
schema. These refer to elements defined in .xsd files that are stored
locally (beside the WSDL),but the import statement is like:
<s:import namespace="some.unreachable.hostname/request.xsd"/>. Clientgen
seems to find them fine, but I wonder if the service is missing them. Any
pointers here?
3. Can anyone give me any pointers / highlight foolish things I may be
doing?
Thanks, George
I think you should probably try running autotype on the schemas in the wsdl then running wsdl2service with typeMappingFile defined as the types.xml created by your autotype ant task.
Thats part of what I had to do when I was at that step.
-Chuy 
I am getting the
java.rmi.RemoteException: web service invoke failed: javax.xml.soap.SOAPException: failed to deserialize xml:weblogic.xml.schema.binding.DeserializationException: type mapping lookup failure on type=
does this mean that the problem is in client invoking the service or the problem in the service.

JAX-RPC Webservice Client with JAX-WS

Hi,
I have JAX-RPC model webservice written by some other team in my company.
I generated java classes with WSDL using "wsimport" . I try to call the service method getting null values from service methods I did not see any errors in log files.
If I call the service methods in JAX-RPC model client(using jar file generated in JAX-RPC model) getting values from service methods.
Please let me know what is the mistake I am doing.
Questions :
Client and webservice both should be in same model(JAX-RPC) or clinet JAX-WS and webservice in JAX-RPC we can access webservice in this mpdel also.
Please help me to resolve this issue.
Thanks 
speculating a bit i would think that in-between client and server there is xml so either model should be valid as long as you have separate jars.
I've seen exact same error when generating Java with wsdlc using JAXRPC and deploy to weblogic with later versions of Eclipse (Juno).
Apparently Juno-Eclipse and previous can only run JAXWS models, even if deployment goes fine.
Workshop on the other hand uses JAXRPC model.
Using a build file and deploy outside Eclipse should work.

Is compiledWsdl the only way to get hand-coded WSDL published?

I am using the contract-first approach to web service development on WebLogic 10.3.5, and I need my own WSDL published with the service, not the WSDL generated by JAX-WS. From my experiments, it seems that the wsdlLocation parameter on the #WebService annotation is ignored unless the compiledWsdl option is used when building the service using jwsc Ant task. I finally did get it to work in this fashion, but only if I placed my WSDL in a "wsdls" folder in the web application root (a sibling of WEB-INF). It also seems like the "wsdls" folder is hard-coded into WebLogic's Ant tasks, since the wsdlc Ant task automatically puts the generated WSDL in this folder in the JWS jar that is generated when explode=false. So I think you must have this as your annotated wsdlLocation, otherwise the jwsc Ant task fails when generating the web service with the compiledWsdl option.
My requirements are simple. I would like to:
1. Write my WSDL
2. Generate code from it using wsdlc and explode=true, so I get source code in packages
3. Generate the service using this source code, not a jar
4. Have the service publish my WSDL using the wsdlLocation parameter of the #WebService attribute, taking the hand-coded WSDL from a folder of my choice
Does anyone know if this possible with WebLogic? 
As per wls documentation I could not find a way and more over compiledWSDL attribute requires a jar file.
http://docs.oracle.com/cd/E21764_01/web.1111/e13758/use_cases.htm#WSGET119
http://docs.oracle.com/cd/E21764_01/web.1111/e13750/anttasks.htm#i1039891
May be worth opening Service Request to see if the any other workaround or if not file enhancement request.
Regards,
Sunil P

Categories

Resources