1 2 Previous Next 15 Replies Latest reply on Jun 4, 2010 8:58 PM by 776716

    Consuming peoplesoft webservices using Jdeveloper authentication error

    776716
      Hi ,

      I am using Jdeveloper 11g to consume the peoplesoft webservice and following the exact steps mentioned in the following article.
      http://www.oracle.com/technology/tech/fmw4apps/peoplesoft/ofm-psft-blog-postings.html#web-services
      The webservice i am using is different than in the example as i am using the production version of wsdl file.
      After following all the steps, the generated proxy does not create getter setters for Username,password(basic authentication).
      Is it suppose to auto generate or do i have to code them??
      I did code the getter setter for username and password and provided the credentials , yet i am getting an authentication failed error.

      java.rmi.RemoteException: SOAPFaultException - FaultCode [{http://schemas.xmlsoap.org/soap/envelope/}Client.Authentication] FaultString [Failed to receive message weblogic.wsee.util.AccessException: The server at http://ps-dev-web.kc.lan:30710/PSIGW/HttpListeningConnector returned a 401 error code (Unauthorized). Please check that username and password are set correctly and that you have permission to access the requested method.
      -> The server at http://ps-dev-web.kc.lan:30710/PSIGW/HttpListeningConnector returned a 401 error code (Unauthorized). Please check that username and password are set correctly and that you have permission to access the requested method.
      ] FaultActor [null] Detail [<detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0">weblogic.wsee.util.AccessException: The server at http://ps-dev-web.kc.lan:30710/PSIGW/HttpListeningConnector returned a 401 error code (Unauthorized). Please check that username and password are set correctly and that you have permission to access the requested method.
      at weblogic.wsee.connection.transport.http.HTTPClientTransport.handleErrorResponse(HTTPClientTransport.java:373)

      The code i used to generate getter, setter is

      //----------------these methods were not generated------------------------------------------------
      public String getPassword() {
      return (String) ((Stub) port).getProperty(Stub.PASSWORD_PROPERTY);
      }

      public void setPassword(String password) {
      ((Stub) port).setProperty(Stub.PASSWORD_PROPERTY, password);
      }

      public String getUsername() {
      return (String) ((Stub) port).getProperty(Stub.USERNAME_PROPERTY);
      }

      public void setUsername(String username) {
      ((Stub) port).setProperty(Stub.USERNAME_PROPERTY, username);
      }
      I am not sure where i am going wrong, the credentials i used work normally but are not working with this application.
      I will appreciate if i can get some light on this issue.

      Thanks
      Ash

      Edited by: ashvini_tharvai@kcmo.org on Jun 2, 2010 7:56 AM
        • 1. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
          776716
          I still have no clue why is this not working, it looks pretty striaght forward to me.
          I will really appreciate if i can get some help on this forum.

          Thanks
          Ash
          • 2. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
            Vishal Jain-Oracle
            Hi,

            To set username/password in jax-rpc based clients, you need to use "ClientUNTCredentialProvider".If you are using latest JDev, then the skeleton code is auto generated for you.
            Essentially, you need something like the following:

            String username = "user";
            String password = "passwd";

            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);

            //Your method call


            Thanks,
            Vishal
            1 person found this helpful
            • 3. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
              776716
              Hi Vishal,

              Thank you for the reply.
              I did try using the method addUNTCredentialProvider(username,password) and not setting the username , password using defualt myPort.setUsername() etc.
              But after this i get the following error
              java.rmi.RemoteException: SOAPFaultException - FaultCode [{http://schemas.xmlsoap.org/soap/envelope/}Client] FaultString [Username missing from request.] FaultActor [null] Detail [<detail></detail>]; nested exception is:
                   weblogic.wsee.jaxrpc.soapfault.WLSOAPFaultException: Username missing from request.
              at project1.proxy.KCM_WEB_CASE_CISoap_Stub.find__CompIntfc__KCM_WEB_CASE_CI(KCM_WEB_CASE_CISoap_Stub.java:93)
                   at project1.proxy.KCM_WEB_CASE_CISoapPortClient.find__CompIntfc__KCM_WEB_CASE_CI(KCM_WEB_CASE_CISoapPortClient.java:200)
                   at project1.proxy.KCM_WEB_CASE_CISoapPortClient.main(KCM_WEB_CASE_CISoapPortClient.java:72)
              Caused by: weblogic.wsee.jaxrpc.soapfault.WLSOAPFaultException: Username missing from request.

              Is there any other way i can do this..i am completely stuck at this point.
              Thank you for your help

              ash
              • 4. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                Vishal Jain-Oracle
                Hi,

                Can you switch on HTTP Analyzer before you run the proxy and capture the SOAP request and paste it here.
                And also, please also give the proxy code you had when you used addUNTCredentialProvider.

                Thanks,
                Vishal
                • 5. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                  776716
                  Hi,

                  I am little new to Jdeveloper & webservices, i did start the HTTP Analyser, but it does not show any thing.
                  Do i need to configure , coz i am just using the default settings.
                  As you know i am just using a standalone java client .
                  Following is the code i used to access the method
                  String username = "abcd";
                  String password = "oracrm9";
                  client.addUNTCredentialProvider(username, password);
                  client.setPortCredentialProviderList();
                  Find__CompIntfc__KCM_WEB_CASE_CITypeShape fShape = new Find__CompIntfc__KCM_WEB_CASE_CITypeShape();
                  CASE_IDTypeShape cShape;
                  System.out.println("before assigment");
                  cShape = new CASE_IDTypeShape();
                  cShape.set_value(2010198052);
                  System.out.println("Entering 1");
                  fShape.setCASE_ID(cShape);
                  Find__CompIntfc__KCM_WEB_CASE_CIResponseTypeShape fcResp;
                  System.out.println("Before calling fcREsp");
                  fcResp = client.find__CompIntfc__KCM_WEB_CASE_CI(fShape);
                  System.out.println("after calling fcREsp");
                  //retrive the return values

                  System.out.println("The respone is "+ fcResp.getKCM_WEB_CASE_CI());
                  System.out.println("FInished");

                  The addUnt method was autogenerated
                  public void addUNTCredentialProvider(String username, String password) {
                  CredentialProvider cp =
                  new ClientUNTCredentialProvider(username.getBytes(), password.getBytes());
                  addCredentialProvider(cp);
                  }
                  public void addCredentialProvider(CredentialProvider cp) {
                  getCredentialProviderList().add(cp);
                  }
                  public List<CredentialProvider> getCredentialProviderList() {
                  if (_credProviders == null)
                  _credProviders = new ArrayList<CredentialProvider>();

                  return _credProviders;
                  }
                  Your suggestions are helpfull, will appreciate if you can guide further.
                  Thanks
                  • 6. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                    Vishal Jain-Oracle
                    Hi,

                    Your code looks fine.This should pass the username token credentials.I do not have a peoplesoft setup to check if the problem is somewhere there, but you can try and create a jax-ws proxy instead of rpc style proxy.
                    This will also give you a client class with skeleton methods, and you need to update the following code to set up the username token:

                    public static void setPortCredentialProviderList(Map<String, Object> requestContext) throws Exception {
                    // TODO - Provide the required values
                    String username = "weblogic1";
                    String password = "weblogic";
                    <no need to update the rest>
                    .
                    .
                    .
                    Comment the following:
                    //credList.add(getBSTCredentialProvider(clientKeyStore, clientKeyStorePassword, clientKeyAlias, clientKeyPassword, serverKeyStore, serverKeyStorePassword, serverKeyAlias, requestContext));
                    //credList.add(getSAMLTrustCredentialProvider());

                    In the main method, write your method call after the following:
                    // Add your code to call the desired methods.

                    Hope this helps.

                    -Vishal
                    1 person found this helpful
                    • 7. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                      776716
                      Hey,

                      Currently i am trying to reinstall everything as in the earlier version the Integrated weblogic server was also not working.
                      Also i did configure the HTTP analyser settings(Proxy Settings), yet it did not show me any data when i ran my program(not sure why that is happening)
                      Besides i once tried using the JAX-ws configuration while creating the proxy but i was not able to figure out how to work with it.
                      Will try your suggestion once i have the middleware installed, hopefully it works this time.
                      Do you have any link to a published webservice which takes username and password, coz when i used a webservice that did not require credentials i was able to connect to it
                      successfully , so was wondering if i could test it for some other webservice that requires credentials.

                      Thank you once again for your suggesstions.

                      Thanks
                      Ashvini
                      • 8. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                        Vishal Jain-Oracle
                        Well,

                        There is a issue with analyzer capturing SOAP traffic when using with secure proxies, so that is why you are not seeing any data there.
                        And I think if you will try your jax-rpc code again, it might work as there was nothing incorrect in your code, so might be that the whole config was corrupt which was throwing out incorrect error(s).
                        About a web service with credentials, you can quickly create one.
                        Have a java class like the following:
                        .
                        import javax.jws.WebService;

                        import weblogic.jws.Policy;

                        @WebService
                        @Policy(uri = "policy:Wssp1.2-2007-Https-UsernameToken-Plain.xml")
                        public class Class1 {
                        public Class1() {
                        super();
                        }

                        public String sayHello() {
                        return "Hi";
                        }
                        }
                        .
                        The procy code for this will be something like:

                        private static Class1Service class1Service;

                        public static void main(String[] args) {
                        try {
                        class1Service = new Class1Service();
                        Class1 class1 = class1Service.getClass1Port();

                        Map<String, Object> requestContext = ((BindingProvider) class1).getRequestContext();
                        setPortCredentialProviderList(requestContext);

                        // Add your code to call the desired methods.
                        System.out.println(class1.sayHello());

                        } catch (Exception ex) {
                        ex.printStackTrace();
                        }
                        }

                        .
                        .
                        public static void setPortCredentialProviderList(Map<String, Object> requestContext) throws Exception {
                        // TODO - Provide the required values
                        String username = "weblogic";
                        String password = "weblogic1";
                        List<CredentialProvider> credList = new ArrayList<CredentialProvider>();

                        // Add the necessary credential providers to the list

                        credList.add(getUNTCredentialProvider(username, password));

                        //credList.add(getBSTCredentialProvider(clientKeyStore, clientKeyStorePassword, clientKeyAlias, clientKeyPassword, serverKeyStore, serverKeyStorePassword, serverKeyAlias, requestContext));

                        //credList.add(getSAMLTrustCredentialProvider());

                        requestContext.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credList);
                        }


                        Thanks,
                        Vishal
                        • 9. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                          776716
                          Hey
                          I resinstalled the jdeveloper and ran my code, but it did not work(the rpc one), still gives me the same error.
                          I tried to configure JAX-WS proxy, but somehow it does not generate any methiods like public static void setPortCredentialProviderList(Map<String, Object> requestContext) throws Exception {
                          It generated a proxyclient which has the following code
                          public class KCM_WEB_CASE_CISoapClient
                          {
                          @WebServiceRef
                          private static KCM_WEB_CASE_CIService kCM_WEB_CASE_CIService;

                          public static void main(String [] args)
                          {
                          kCM_WEB_CASE_CIService = new KCM_WEB_CASE_CIService();
                          KCM_WEB_CASE_CISoap kCM_WEB_CASE_CISoap = kCM_WEB_CASE_CIService.getKCM_WEB_CASE_CISoap();
                          // Add your code to call the desired methods.
                          }
                          }
                          I dont know where can i set the credentials in this one.
                          i selected all the defaults while creating the proxy from wsdl file.
                          any idea on this one??
                          Thanks
                          Ashvini
                          • 10. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                            776716
                            Hey Vishal,

                            I am able to connect to the webservice using JAX-WS, had to write the complete code where i initialized all the security data etc.
                            And it finally worked.
                            Thanks for all your help!!
                            I am still unsure about why it did not worked with jax-rpc.
                            Following is the code i wrote in SoapClient just for future reference
                            public static void main(String [] args)
                            {
                            kCM_WEB_CASE_CIService = new KCM_WEB_CASE_CIService();
                            KCM_WEB_CASE_CISoap kCM_WEB_CASE_CISoap = kCM_WEB_CASE_CIService.getKCM_WEB_CASE_CISoap();
                            // Add your code to call the desired methods.
                            System.out.println("Begin-------------------------");
                            FindCompIntfcKCMWEBCASECITypeShape fShape = new FindCompIntfcKCMWEBCASECITypeShape();
                            CASEIDTypeShape cShape;
                            DISPTMPLIDTypeShape dShape = new DISPTMPLIDTypeShape();
                            BUSINESSUNITTypeShape bShape = new BUSINESSUNITTypeShape();
                            SecurityTypeShape sShape = new SecurityTypeShape();
                            UsernameTokenTypeShape utShape = new UsernameTokenTypeShape();
                            UsernameTypeShape uShape = new UsernameTypeShape();
                            PasswordTypeShape pShape = new PasswordTypeShape();
                            KCMWEBCASECITypeShape kShape = new KCMWEBCASECITypeShape();
                            System.out.println("After initializing all the shapes");
                            cShape = new CASEIDTypeShape();
                            cShape.setValue(2010000096);
                            dShape.setValue("");
                            bShape.setValue("");
                            uShape.setValue("abcd");
                            pShape.setValue("oracrm9");
                            utShape.setUsername(uShape);
                            utShape.setPassword(pShape);
                            sShape.setUsernameToken(utShape);
                            System.out.println("After setting all the values");
                            List<project1.types.KCMWEBCASECITypeShape> kList = new ArrayList();

                            try {
                            kList =
                            kCM_WEB_CASE_CISoap.findCompIntfcKCMWEBCASECI(cShape,dShape,bShape,sShape);
                            kShape = kList.get(0);
                            System.out.println("The values retrieved "+kShape.getCASEID().getValue()+" Business Unit "+kShape.getBUSINESSUNIT().getValue());
                            } catch (Fault e) {
                            System.out.println("The error encountered is "+e.getMessage());
                            }
                            System.out.println("after calling the find method");


                            System.out.println("FInished");
                            }
                            • 11. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                              776716
                              Hey,

                              I was successfull in getting connected to the webservice and also fetch values for the method mentioned in the above posts.
                              But i am not sure how to deal with INOUT parameters, since the method generated for such operations have void return type.
                              In this case how do i handle the data. I understand it creates some holder for such datatypes but i am not very sure how can i handle that.

                              for ex
                              public void createCompIntfcKCMWEBCASECI(@WebParam(targetNamespace="http://peoplesoft.com/KCM_WEB_CASE_CI",
                              name="CASE_ID")
                              project1.types.CASEIDTypeShape caseid, @WebParam(targetNamespace="http://peoplesoft.com/KCM_WEB_CASE_CI",
                              name="DISP_TMPL_ID")
                              project1.types.DISPTMPLIDTypeShape disptmplid,
                              @WebParam(targetNamespace="http://peoplesoft.com/KCM_WEB_CASE_CI",
                              name="QUICK_CD")
                              @WebParam(targetNamespace="http://peoplesoft.com/KCM_WEB_CASE_CI",
                              name="*notification*", mode=Mode.OUT)
                              Holder<project1.types.NotificationTypeShape> notification,
                              @WebParam(targetNamespace="http://peoplesoft.com/KCM_WEB_CASE_CI",
                              name="*detail*", mode=Mode.OUT)
                              Holder<project1.types.DetailTypeShape> detail,
                              @WebParam(targetNamespace="http://schemas.xmlsoap.org/ws/2002/xx/secext",
                              name="Security", header=true)
                              project1.types.SecurityTypeShape parameter)
                              throws project1.proxy.Fault;

                              As you see in the above code notification and detail are declared "out", but the method generated returns nothing.
                              Can any one explain how to handle this or atleast point to some tutorial??

                              Thanks
                              Ashvini
                              • 12. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                                Vishal Jain-Oracle
                                Out parameters are used as a placeholder for a return value of the web service. The web service returns its result by writing it to the out parameter.
                                Inout parameters let you pass a value to a web service and lets the web service return its result by overwriting the parameter value.
                                In your case the method return type is void, but after the method call, the values are stored in the detail and notification parameters.

                                Thanks,
                                Vishal
                                1 person found this helpful
                                • 13. Re: Consuming peoplesoft webservices using Jdeveloper authentication error
                                  Vishal Jain-Oracle
                                  In Your case, the parameters are not IN/OUT but OUT.
                                  To create Holder and get the values after invoking the operation, you need to do something like this:

                                  // Create the Holder parameters
                                  Holder<Type> nt = new Holder<Type>();
                                  Holder<Type> det = new Holder<Type>();

                                  // Make the call
                                  port.createCompIntfcKCMWEBCASECI(nt, det);

                                  //Get the value
                                  System.out.println("Value is " + nt.Value());

                                  Thanks,
                                  Vishal
                                  1 2 Previous Next