11 Replies Latest reply on Jun 26, 2012 11:44 AM by User696-Oracle

    Getting Remote Exception

    user3351545
      Hi,

      I'm uploading this issue for the first time in this Weblogic-Webservice forum. Incase if I'm missing some thing, please let me knw....


      I’m working on the Client Application for calling a remote WebService. I’m facing an issue when I’m trying to invoke the WebService call.

      We are using Weblogic Server 10.0 MP1 version and JRockit JDK 1.5 with Oracle 10gR2.

      I have created JAX-RPC Client using ClientGen Ant Task of the Weblogic Server to generate the Client Artifacts for the WebService.

      When I try to invoke the Webservice Call, I’m getting the below remote exception:-

      *<WSEE:41>Incoming message missing code = 1001<SmartSecurityPolicyBlueprint.tellMeWhy:348>*
      Remote Exception Occured: java.rmi.RemoteException: Error codes: 1001 Error code:1001; nested exception is:
      weblogic.wsee.security.wss.policy.SecurityPolicyInspectionException: Error codes: 1001 Error code:1001……
      ……
      Caused by: weblogic.wsee.security.wss.policy.SecurityPolicyInspectionException: Error codes: 1001 Error code:1001
      at weblogic.wsee.security.wss.sps.SmartPolicySelector.getSmartPolicyBlueprint(SmartPolicySelector.java:425)
      at weblogic.wsee.security.wss.SecurityPolicyInspector.processMessagePolicy(SecurityPolicyInspector.java:78)
      at weblogic.wsee.security.wss.SecurityPolicyConductor.processResponseOutbound(SecurityPolicyConductor.java:169)
      at weblogic.wsee.security.wss.SecurityPolicyConductor.processResponseOutbound(SecurityPolicyConductor.java:141)
      at weblogic.wsee.security.wssp.handlers.WssHandler.postValidate(WssHandler.java:339)
      at weblogic.wsee.security.wssp.handlers.PreWssClientPolicyHandler.processResponse(PreWssClientPolicyHandler.java:59)
      at weblogic.wsee.security.wssp.handlers.WssHandler.handleResponse(WssHandler.java:128)
      at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:236)
      ……
      ……

      I even tried some googling on this issue but could not find any information related to this issue

      Can anyone help me in solving this issue?

      Thanx in advance!
        • 1. Re: Getting Remote Exception
          User696-Oracle
          Hi,

          The error is because you might be using ws-policy(ws-security) it might be missing some authentication security headers.

          HTH
          Regards,
          Sunil P
          1 person found this helpful
          • 2. Re: Getting Remote Exception
            user3351545
            Hi,

            Thanks for your reply...

            I tried to print the Soap response that I'm getting from the Remote WebService using Client Handler code. Its is printing the response properly through client handleResponse method. But getting this remote exception in the code.

            If the issue is with the security header that I'm passing in the soap request to the webservice, then I should not get the response right.. But the webService is sending the response properly which I can see through client handler code..


            Is there anything that I'm missing out while sending the soap request ?

            Or is this issue due to the response header that is sent back from the webservice which I need to handle here at client side?

            Please note that the webService is sending response with the header as

            *<soapenv:Header>*
            *<wsse:Security soapenv:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>*
            *</soapenv:Header>*

            Could this be the issue? Is there any thing that I need to handle with the response in the client application.?

            Can you please clarify me?
            • 3. Re: Getting Remote Exception
              User696-Oracle
              Hi,

              I think the response might be expecting AUTHENTICATION. Since the authentication is missing your getting the error What is policy file you have used?

              Regards,
              Sunil P
              • 4. Re: Getting Remote Exception
                user3351545
                Hi Sunil,

                Thanx again for replying.


                I'm not using any policy file at the client side.

                I'm using the below code to set the security header username token in the Soap Request

                System.out.println("Setting Header Credentials");
                List credProviders = new ArrayList();
                CredentialProvider cp = new ClientUNTCredentialProvider(username.getBytes(),password.getBytes());
                credProviders.add(cp);

                Stub stub = (Stub)port;
                stub._setProperty(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credProviders);

                System.out.println("Setting Header Credentials done");

                Is there anything else I need to do for handling the response ? Is it required to have a policy file at the client application ?


                Thanks...

                Edited by: user3351545 on Jun 21, 2012 7:10 AM
                • 5. Re: Getting Remote Exception
                  User696-Oracle
                  Hi,

                  can you check on service side what is policy your using. I am sure you might be using username token but wanted to how is it defined.
                  or if you can check the wsdl file that might have information. check both your client side wsdl and server side wsdl

                  Regards,
                  Sunil P
                  1 person found this helpful
                  • 6. Re: Getting Remote Exception
                    user3351545
                    Hi Sunil,


                    I checked the wsdl file. It is having this below security policy code embedded in it..

                              <wsp:Policy
                                   xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                                   Id="UsernameTokenOverHTTPS">
                                   <wsp:ExactlyOne>
                                        <wsp:All>
                                             <sp:TransportBinding
                                                  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                                                  <wsp:Policy>
                                                       <sp:TransportToken>

                                                            <wsp:Policy>
                                                                 <sp:HttpsToken
                                                                      RequireClientCertificate="false" />
                                                            </wsp:Policy>
                                                       </sp:TransportToken>
                                                       <sp:AlgorithmSuite>
                                                            <wsp:Policy>
                                                                 <sp:Basic256 />
                                                            </wsp:Policy>
                                                       </sp:AlgorithmSuite>

                                                       <sp:Layout>
                                                            <wsp:Policy>
                                                                 <sp:Lax />
                                                            </wsp:Policy>
                                                       </sp:Layout>
                                                  </wsp:Policy>
                                             </sp:TransportBinding>
                                             <sp:SignedSupportingTokens
                                                  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                                                  <wsp:Policy>

                                                       <sp:UsernameToken
                                                            sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Always" />
                                                  </wsp:Policy>
                                             </sp:SignedSupportingTokens>
                                        </wsp:All>
                                   </wsp:ExactlyOne>
                              </wsp:Policy>


                    If you require any other info, please let me know....


                    Thanks....
                    • 7. Re: Getting Remote Exception
                      User696-Oracle
                      please change the policy file under UsernameToken --> AlwaysToRecipient(http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient
                      )

                      So that is why your getting exception
                      http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never
                           The token MUST NOT be included in any messages sent between the initiator and the recipient; rather, an external reference to the token should be used.

                      http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Once
                           The token MUST be included in only one message sent from the initiator to the recipient. References to the token MAY use an internal reference mechanism. Subsequent related messages sent between the recipient and the initiator may refer to the token using an external reference mechanism.

                      http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient
                           The token MUST be included in all messages sent from initiator to the recipient. The token MUST NOT be included in messages sent from the recipient to the initiator.

                      http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToInitiator
                           The token MUST be included in all messages sent from the recipient to the initiator. The token MUST NOT be included in messages sent from the initiator to the recipient.
                      http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Always     
                      The token MUST be included in all messages sent between the initiator and the recipient. This is the default behavior.


                      Since this is "Always" the client side is failing because there is no authentication.

                      Regards,
                      Sunil P
                      • 8. Re: Getting Remote Exception
                        user3351545
                        Hi Sunil,


                        I tried making the changes to the client side copy of webservice wsdl file which we use to generate client artifacts as below in the wsdl copy.

                                  <wsp:Policy
                                       xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                                       Id="UsernameTokenOverHTTPS">
                                       <wsp:ExactlyOne>
                                            <wsp:All>
                                                 <sp:TransportBinding
                                                      xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                                                      <wsp:Policy>
                                                           <sp:TransportToken>

                                                                <wsp:Policy>
                                                                     <sp:HttpsToken
                                                                          RequireClientCertificate="false" />
                                                                </wsp:Policy>
                                                           </sp:TransportToken>
                                                           <sp:AlgorithmSuite>
                                                                <wsp:Policy>
                                                                     <sp:Basic256 />
                                                                </wsp:Policy>
                                                           </sp:AlgorithmSuite>

                                                           <sp:Layout>
                                                                <wsp:Policy>
                                                                     <sp:Lax />
                                                                </wsp:Policy>
                                                           </sp:Layout>
                                                      </wsp:Policy>
                                                 </sp:TransportBinding>
                                                 <sp:SignedSupportingTokens
                                                      xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                                                      <wsp:Policy>

                                                           <sp:UsernameToken
                                                                sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
                                                      </wsp:Policy>
                                                 </sp:SignedSupportingTokens>
                                            </wsp:All>
                                       </wsp:ExactlyOne>
                                  </wsp:Policy>


                        I made the above changes as you suggested and recompiled it (generated client artifacts) and tested with it.. But still getting the same remote exception.

                        Can you please clarify the below queries :-

                        1. Where exactly I need to do the changes ?
                        2. Do we need to change in the client copy of webservice wsdl which we use or Do we need to ask the remote webservice people to change it in their wsdl file ?
                        3. Even after making the changes to my client copy of wsdl ? why I'm still getting the same remote exception?
                        Am I making any mistake in making changes ?


                        Can you please suggest?.

                        Edited by: user3351545 on Jun 22, 2012 3:39 AM
                        • 9. Re: Getting Remote Exception
                          User696-Oracle
                          HI ,

                          Please change it on remote webservice (hosting web service) and test it.
                          If your still getting exception. I would suggest to open SR with Oracle support to debug further.

                          Regards,
                          Sunil P
                          • 10. Re: Getting Remote Exception
                            user3351545
                            Hi Sunil,

                            Thanks a lot. It worked...

                            The Issue has been resolved......

                            Really appreciate your support and quick reply and help in solving this issue.

                            Many Many Thanks for your valuable support.....

                            Thanks again...
                            • 11. Re: Getting Remote Exception
                              User696-Oracle
                              Hi,

                              I am glad that it is working. Thank you for marking the post as answered.

                              Regards,
                              Sunil P