Pages

Monday, November 21, 2011

Solving __OAUX_GENXSD_.TOP.XSD with BPEL

When you use an external web service in combination with a BPEL service component in an Oracle SOA Suite 11g composite and you follow this great AIA blog about Best Practices for Decoupling Services and Avoiding Invalid Composites at Server Startup then you can get this __OAUX_GENXSD_.TOP.XSD error in

  • JDeveloper, when you build the composite.
  • On the SOA Suite when the service is invoked for the second time, probably on your test or acceptance environment. 
Before we start with the possible fixes, first why do you get this error. 

You can only get this error when you use BPEL in your composite. With the mediator service component I don't get this error.

In my test composite I have a simple OSB proxy and use this as a reference. So I provide the WSDL url to the WS adapter and enabled the option to download the WSDL to your project.   


Because I don't want any deployment problems ( invalid composites at deployment time or at a soa server reboot when the OSB proxy is down ). I downloaded the XSDs of the WSDL, fixed the WSDL imports. Now we can put the WSDL and the XSDs in our project folder or add them to a central place like the MDS. 

When we take a look at the reference part in the composite.xml you will see the following.
The endpoint is loaded from the Customer.wsdl ( location attribute of the binding.ws element ) and uses the port attribute to find the endpoint in the Customer.wsdl.


Here is the wsdl with the endpoint.


This works great in development ( cause you don't need to change anything)  but when you have to deploy to test or acceptance you will generate a config plan where you override the location attribute of the binding.ws (reference) with the Test OSB Proxy WSDL url, so it will use that endpoint for test or acceptance.

On the SOA Suite you can invoke this service once and after that you can get this __OAUX_GENXSD_.TOP.XSD error. Somehow the second time the SOA Suite will retrieve the test OSB Proxy WSDL and it's XSDs from the cache and it compares it with the local XSDs of your project or MDS. When there is a difference in one of the XSDs you will get this error ( can be something minor like an element annotation ). 
    
This can also happen in the JDeveloper SOA Composite builder when you load the same XSDs local and remote. 


So the solution is to keep the XML schemas in sync ( remote and local ) but this is almost impossible or you need to build everything with Maven or ANT and always replace the XSDs in every project. This also requires a lot of unit testing.

Even then you probably don't have much influence on remote services. 

So the best solution is to avoid the loading of remote WSDL. You only need to update the endpoint for the Test or acceptance environment, not to load the whole WSDL. So don't try to replace the location attribute of the binding.ws element in the composite.xml but try to update the endpoint in the WSDL located in your project or in the MDS.   

And if you use contract first Java (EJB) Web Services in Oracle Suite then you should always use the WSDL and the XSDs in your Java Web Services else you will get different schema imports then the original WSDL & XSDs.

I tested this with the Patch Set 3 version of SOA Suite 11g. 

23 comments:

  1. Hi Edward,

    I have a problem in removing the soap envelope from the request xml.

    I am giving you the brief introduction of my problem.

    1)I have a soap/jms based proxy service(TestAsyncPS).

    2)This proxy passes the request to a local based proxy service(TestLocalPS).

    3)This TestLocalPS dumps the request in a queue using Business service(TestBS(Soap based))

    4)Another proxy(RouteProxy) is listening to the queue and through Http based Business Service hits the provider.

    The provider accepts only AnyXml request but the request that i am giving to the provider is Soap based.
    so could you please tell me how can i remove the soap envelope and send only the content of the body.

    ReplyDelete
  2. Hi Edward,

    I have a problem in removing the soap envelope from the request xml.

    I am giving you the brief introduction of my problem.

    1)I have a soap/jms based proxy service(TestAsyncPS).

    2)This proxy passes the request to a local based proxy service(TestLocalPS).

    3)This TestLocalPS dumps the request in a queue using Business service(TestBS(Soap based))

    4)Another proxy(RouteProxy) is listening to the queue and through Http based Business Service hits the provider.

    The provider accepts only AnyXml request but the request that i am giving to the provider is Soap based.
    so could you please tell me how can i remove the soap envelope and send only the content of the body.

    ReplyDelete
  3. Hi,

    when you replace the body var with just the content of the body

    does it work then.

    thanks

    ReplyDelete
  4. 1) I have a problem with SAML on Weblogic. May be You can help me. I protect my webservice by WssSamlV11Token11 (SAML 1.1). I configure SAMLIdentityAsserterV2 and Asserting Party for my service. All was OK. But now i need validate several AudienceURI for one Target URL. Is it possible? If I create several Asserting party with one Target URL, one Issuer URI and different Audience URI, than only last created party is valid.
    For example:
    Asserting party 1: Target URL is "http:\\abc.com", Issuer URI is "http:\\abc\issuer.com", Audience URI is "http:\\audience1.com"

    Asserting party 2: Target URL is "http:\\abc.com", Issuer URI is "http:\\abc\issuer.com", Audience URI is "http:\\audience2.com"

    Asserting party 3: Target URL is "http:\\abc.com", Issuer URI is "http:\\abc\issuer.com", Audience URI is "http:\\audience3.com"

    Only "http:\\audience3.com" is valid. "http:\\audience1.com" and "http:\\audience2.com" get error "Security token failed to validate. weblogic.xml.crypto.wss.SecurityTokenValidateResult@67a58ecc[status: false][msg The SAML token is not valid, it is rejected by CSS ]"
    Can you give me a council? May be possible set several AudienceURI in one Asserting party or something like?

    2) If problem hasn’t solution for SAML 1.1, than I can try do this with SAML 2.0 SAML2IdentityAsserter (because settings for SAML 2.0 has a list for Audience URI’s). But my first attempt return a fault “The SAML token is not valid, it is rejected by CSS”. I try follow analogy with SAML 1.1 settings. I create “New WebService Identity Provider Partners”, set “Issuer URI”, “Audience URI”, “Assertion Signing Certificate Alias” values from SAML 1.1 settings and check similar checkbox. But SAML 2.0 settings hasn’t analogue field for “Target URL” from SAML 1.1 Asserting party. Is problem here? May be “Target URL” for SAML 2.0 is name of “Identity Provider Partner”?

    Thanks

    ReplyDelete
  5. 1) I have a problem with SAML on Weblogic. May be You can help me. I protect my webservice by WssSamlV11Token11 (SAML 1.1). I configure SAMLIdentityAsserterV2 and Asserting Party for my service. All was OK. But now i need validate several AudienceURI for one Target URL. Is it possible? If I create several Asserting party with one Target URL, one Issuer URI and different Audience URI, than only last created party is valid.
    For example:
    Asserting party 1: Target URL is "http:\\abc.com", Issuer URI is "http:\\abc\issuer.com", Audience URI is "http:\\audience1.com"

    Asserting party 2: Target URL is "http:\\abc.com", Issuer URI is "http:\\abc\issuer.com", Audience URI is "http:\\audience2.com"

    Asserting party 3: Target URL is "http:\\abc.com", Issuer URI is "http:\\abc\issuer.com", Audience URI is "http:\\audience3.com"

    Only "http:\\audience3.com" is valid. "http:\\audience1.com" and "http:\\audience2.com" get error "Security token failed to validate. weblogic.xml.crypto.wss.SecurityTokenValidateResult@67a58ecc[status: false][msg The SAML token is not valid, it is rejected by CSS ]"
    Can you give me a council? May be possible set several AudienceURI in one Asserting party or something like?

    2) If problem hasn’t solution for SAML 1.1, than I can try do this with SAML 2.0 SAML2IdentityAsserter (because settings for SAML 2.0 has a list for Audience URI’s). But my first attempt return a fault “The SAML token is not valid, it is rejected by CSS”. I try follow analogy with SAML 1.1 settings. I create “New WebService Identity Provider Partners”, set “Issuer URI”, “Audience URI”, “Assertion Signing Certificate Alias” values from SAML 1.1 settings and check similar checkbox. But SAML 2.0 settings hasn’t analogue field for “Target URL” from SAML 1.1 Asserting party. Is problem here? May be “Target URL” for SAML 2.0 is name of “Identity Provider Partner”?

    Thanks

    ReplyDelete
  6. "You can only get this error when you use BPEL in your composite. With the mediator service component I don't get this error."

    I have the same error using just a simple mediator calling an external webservice. Still got to figure out why this goes wrong but it seems not only comitted to BPEL. Running PS4 btw so that might be a difference.

    ReplyDelete
    Replies
    1. Hi,

      in this mediator do you have locally the same namespace (xsd or wsdl ) as in the remote service. I know with BPEL it checks if even the comments of the xsd and compare this to the locally stored ones.

      thanks

      Delete
  7. Hi,
    Our developers are putting in concrete wsdls in MDS. They have the actual endpoint in the WSDLs which are residing in MDS. As I think this cannot be replaced by the configuration plan for various environments. The configuration plan works only with composites and not directly with MDS. Is that correct. Thats the reason they need to redploy MDS by changing the end points when the move from Dev to Test environments. Can you suggest a way around this?
    Thanks.

    ReplyDelete
    Replies
    1. Hi,

      you can have the following situations

      no mds or local wsdl
      <reference name="HrWSReference"
      ui:wsdlLocation="http://soaps5:8001/HrSessionBean/HrSessionBeanService?wsdl">
      <interface.wsdl interface="http://services.hr.model.soa.whitehorses.nl/#wsdl.interface(HrSessionBeanService)"/>
      <binding.ws port="http://services.hr.model.soa.whitehorses.nl/#wsdl.endpoint(HrSessionBeanService/HrSessionBeanServicePort)"
      location="http://soaps5:8001/HrSessionBean/HrSessionBeanService?wsdl"
      soapVersion="1.1">
      <property name="weblogic.wsee.wsat.transaction.flowOption"
      type="xs:string" many="false">WSDLDriven</property>
      </binding.ws>
      </reference>

      this is easy to change

      and you can a mds or local wsdl like this.

      <reference name="HrWSReference"
      ui:wsdlLocation="oramds:/apps/my/HrSessionBeanService?wsdl">
      <interface.wsdl interface="http://services.hr.model.soa.whitehorses.nl/#wsdl.interface(HrSessionBeanService)"/>
      <binding.ws port="http://services.hr.model.soa.whitehorses.nl/#wsdl.endpoint(HrSessionBeanService/HrSessionBeanServicePort)"
      location="oramds:/apps/my/HrSessionBeanService?wsdl"
      soapVersion="1.1">
      <property name="weblogic.wsee.wsat.transaction.flowOption"
      type="xs:string" many="false">WSDLDriven</property>
      </binding.ws>
      </reference>

      with a deployment plan you only need to change the location attribute on the binding.ws element.
      add the location of the wsdl of your test or production wsdl.

      with this as result

      <reference name="HrWSReference"
      ui:wsdlLocation="oramds:/apps/my/HrSessionBeanService?wsdl">
      <interface.wsdl interface="http://services.hr.model.soa.whitehorses.nl/#wsdl.interface(HrSessionBeanService)"/>
      <binding.ws port="http://services.hr.model.soa.whitehorses.nl/#wsdl.endpoint(HrSessionBeanService/HrSessionBeanServicePort)"
      location="http://prod:8001/HrSessionBean/HrSessionBeanService?wsdl"
      soapVersion="1.1">
      <property name="weblogic.wsee.wsat.transaction.flowOption"
      type="xs:string" many="false">WSDLDriven</property>
      </binding.ws>
      </reference>


      so you can re-use the sar files ( compile and package once and deploy it everywhere ) and only need to have different deployment plan.

      here you got some ectra info
      https://blogs.oracle.com/aia/entry/aia_11g_best_practices_for_dec


      thanks

      Delete
    2. Thanks for this. In short. We should have only abstract WSDLs and not any concrete End points in MDS. Is that correct?

      Delete
    3. Hi,

      you dont need to have it , only the location attribute on the binding.ws element must contain a wsdl which contains an endpoint . this is necessary only on runtime.

      can you post your composite reference , or do you override it from bpel ( like dynamic endpoint )

      thanks

      Delete
  8. http://devhost:7001/soa-infra/services/CCB2-MDM2/ErrorHandling!1.0/ErrorHandling.wsdl






























    The above WSDL is stored in MDS. The problem is the developers need to change the devhost:port to testhost:port in this WSDL and redeploy this in the MDS when they move from dev to test environment. As they cannot dynamically change this for every environment like we can do in a BPEL composite.

    ReplyDelete
  9. Ok,

    first remove the abstractWSDL in the documentation. no need for that.
    the schema imports should use relative path or also use oramds ( always store the xsd also in the mds )

    you can leave the soap:address endpoint like this , ( this way you don't need a plan for development )

    thanks

    ReplyDelete
  10. Thanks for this. If we leave the soap:address as is. We will need to redeploy the WSDL for test, integration and other environments. This cannot be replaced dynamically as this WSDL is residing inside the MDS. Is this correct or am I missing something? The config plan will not replace anything in the MDS.

    ReplyDelete
  11. Hi,

    you never have to replace the wsdl in the mds

    just do this

    first remove the abstractWSDL in the documentation.
    the schema imports of the wsdl should use relative path or use oramds
    always store the wsdl xsd in the mds

    you can leave the soap:address endpoint to dev, no need to change

    then make deployment plan for test etc.
    where you overide the location attribute on the binding.ws element which contain the wsdl url of test etc.

    ReplyDelete
  12. Thanks. Will try this and let you know.

    ReplyDelete
  13. Hi,
    I have a Composite with BPEL having a wire with a mediator.
    The composite also has a BPM Process.
    I am facing this issue and the BPM Process is not getting loaded.
    But for the same composite the BPEL is working fine.
    I am using the Services created by some other team.
    In my bindings.ws tag, The location is set to "".
    Can this be a possible cause of the problem.

    ReplyDelete
    Replies
    1. Hi,

      an empty binding.ws is strange and maybe there re-used a BPEL xsd or using the smae namespace in BPM.

      Thanks

      Delete
    2. I am setting this binding through a deployment plan.

      Delete
  14. I faced the same issue. I got this corrected by changing the reference of RoutingSlipList.xsd file.

    My TaskService.xsd file was referring to oramds but RoutingSlipList.xsd was pointing to project reference. So after correcting it as below.

    oramds:/soa/shared/workflow/RoutingSlipList.xsd

    Regards,
    Vikrant Korde.

    ReplyDelete
  15. Great article, it was very helpful! I just started in this and I'm getting to know it better! Cheers, keep up the good work!
    w3 plans

    ReplyDelete
  16. Hi,

    I am getting similar error which i add a new element in the existing XSD.

    The Strange part is, when i compile/build the code with the old xsd in my Jdev(Connected via DB based MDS) i am able to successfully build/compile.

    whereas when i add the new element in the XSD (Updated the xsd in MSD using Ant updateMDS, Also tried with ./wlst command.)
    Post that when i compile my code i m getting the error

    Error(163): query "/client:absReply/client:primary_error_reason" is invalid, because oracle.xml.parser.schema.XSDException: Can not build schema 'http://www.siebel.com/xml/Abssiebel' located at 'http://www.siebel.com/xml/Abssiebel.__OAUX_GENXSD_.TOP.XSD' [Cause=Can not build schema 'http://www.siebel.com/xml/Abssiebel' located at 'http://www.siebel.com/xml/Abssiebel.__OAUX_GENXSD_.TOP.XSD']
    It would be great if you can guide me where am i making mistake.

    ReplyDelete