3 Replies Latest reply: Jan 28, 2013 9:06 AM by carlos cortez RSS

    Error when trying to access a secured web service from Forms 10g 10.1.2.3

    carlos cortez
      Hello,

      I'm trying to access a secured web service from Forms10g 10.1.2.3 but i'm getting the next error when pressing the button the first time:
      java.rmi.RemoteException: ; nested exception is: HTTP transport error: javax.xml.soap.SOAPException: 
      java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Bad response: 401 Unauthorize
      When i press the button a second time i got this error:
      javax.xml.rpc.soap.SOAPFaultException: The SOAP request is invalid. The required node 'Envelope' is missing
      This is the code i have in my button:
      DECLARE
      jo ora_java.jobject;
      pdfObject ora_java.jobject;
      pdf     varchar2(900);
      rv varchar2(100);
      ex ora_java.jobject;
      
      BEGIN
           
      JO := SEARCHSOAPCLIENT.new;
      
      SEARCHSOAPCLIENT.setUsername(JO,'weblogic');
      SEARCHSOAPCLIENT.setPassword(JO,'welcome1');
      
      pdfObject := SEARCHSOAPCLIENT.quicksearch(JO,'1234',NULL);
      
      pdf := SEARCHSOAPCLIENT.tostring(pdfObject);
      message(pdf);
      message(' ');
      
      
      EXCEPTION
      WHEN ORA_JAVA.JAVA_ERROR then 
      message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
      WHEN ORA_JAVA.EXCEPTION_THROWN then 
      ex := ORA_JAVA.LAST_EXCEPTION;
      :error := Exception_.toString(ex);
      
      END;
      When i run it from JDeveloper it works, this is a portion of java code the proxy web service has:
      import oracle.webservices.transport.ClientTransport;
      import oracle.webservices.OracleStub;
      import javax.xml.rpc.ServiceFactory;
      import javax.xml.rpc.Stub;
      
      
      
      
      public class SearchSoapClient {
          private webservicesproxywebcontent.proxy.SearchSoap _port;
      
      
          
          public SearchSoapClient() throws Exception {
              ServiceFactory factory = ServiceFactory.newInstance();
              _port = ((webservicesproxywebcontent.proxy.Search)factory.loadService(webservicesproxywebcontent.proxy.Search.class)).getSearchSoap();
              
              this.setUsername("weblogic");
              this.setPassword("welcome1");
      
              System.out.println("callling from _port "+ _port.quickSearch("1234234", null));
              
          }
          
       
          /**
           * @param args
           */
          public static void main(String[] args) {
              try {
                  webservicesproxywebcontent.proxy.SearchSoapClient myPort = new webservicesproxywebcontent.proxy.SearchSoapClient();
      
                  System.out.println("calling " + myPort.getEndpoint());
        
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
          }
          
          /**
           * delegate all operations to the underlying implementation class.
           */
          
          public QuickSearchResult quickSearch(String queryText, IdcPropertyList extraProps) throws java.rmi.RemoteException {
              
             
              return _port.quickSearch(queryText, extraProps);
          }
      Also the secured web service was generated from Webcenter Content 11.1.1.6 that is why it's a secured web service.

      Kind Regards
      Carlos