• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1399
  • Last Modified:

Consume Oracle 11g Native WebService

Hello.

I have a Test Webservice, with the attached WSDL

 SIM-FILIAL-USUARIO-TESTE.wsdl.txt


I have created a java client application, but it keeps returning me:


java.lang.IllegalArgumentException: faultCode argument for createFault was passed NULL
      at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl.createFault(SOAPFactory1_1Impl.java:55)
      at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:169)
      at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
      at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
      at $Proxy27.simFILIALUSUARIOTESTE(Unknown Source)
      at TesteXDB.testeXDB(TesteXDB.java:41)
      at TesteXDB.main(TesteXDB.java:50)


Authentication seems to be ok. Where should I start looking?

The java code:


import java.net.Authenticator;
import java.net.PasswordAuthentication;
import com.oracle.xmlns.orawsv.bi_demo.sim_filial_usuario_teste.SIMFILIALUSUARIOTESTEService;
import com.oracle.xmlns.orawsv.bi_demo.sim_filial_usuario_teste.SIMFILIALUSUARIOTESTEPortType;
import com.oracle.xmlns.orawsv.bi_demo.sim_filial_usuario_teste.SNUMBERSIMFILIALUSUARIOTESTEInput;
import com.oracle.xmlns.orawsv.bi_demo.sim_filial_usuario_teste.SIMFILIALUSUARIOTESTEOutput;

class TesteXDB {

public class MyAuthenticator extends Authenticator {

    private String user;
    private String password;

    public MyAuthenticator(String user,String password) {
      this.user = user;
      this.password = password;
    }


    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
        PasswordAuthentication auth = new PasswordAuthentication(user,password.toCharArray());
        return auth;
    }
}

  public void testeXDB(){


    try { // Call Web Service Operation
        SIMFILIALUSUARIOTESTEService service = new SIMFILIALUSUARIOTESTEService();
        SIMFILIALUSUARIOTESTEPortType port = service.getSIMFILIALUSUARIOTESTEPort();

      MyAuthenticator myAuth = new MyAuthenticator("BI_DEMO","bi_demo");
      Authenticator.setDefault(myAuth);

        SNUMBERSIMFILIALUSUARIOTESTEInput parameters = new SNUMBERSIMFILIALUSUARIOTESTEInput();
          parameters.setSACUSUARIO$VARCHAR2IN("MSVSIM");
          parameters.setSENHA$VARCHAR2IN("msv1");
        SIMFILIALUSUARIOTESTEOutput result = port.simFILIALUSUARIOTESTE(parameters);
        System.out.println("Result = "+result);
    } catch (Throwable e1) {e1.printStackTrace();}

  }

  public static void main(String[] args) throws Exception {

      TesteXDB t = new TesteXDB();
      t.testeXDB();
      System.out.println("Result = ABCDEFG");

    }



}
0
cinglez
Asked:
cinglez
  • 3
1 Solution
 
cinglezAuthor Commented:
I passed this point. Actually, it was missing the lib diretory for the client. The problem now is authentication.

I keep getting "org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized".

My java code now is:


import java.net.Authenticator;
import java.net.PasswordAuthentication;
import com.oracle.xmlns.orawsv.scott.empcount.EMPCOUNTService;
import com.oracle.xmlns.orawsv.scott.empcount.EMPCOUNTPortType;
import com.oracle.xmlns.orawsv.scott.empcount.SNUMBEREMPCOUNTInput;
import com.oracle.xmlns.orawsv.scott.empcount.EMPCOUNTOutput;
import

class EMPCOUNT_XDB {

  public class MyAuthenticator extends Authenticator {

    private String user;
    private String password;

    public MyAuthenticator(String user,String password) {
      this.user = user;
      this.password = password;
    }

    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
        PasswordAuthentication auth = new PasswordAuthentication(user,password.toCharArray());
        return auth;
    }
  }

    public void empcountXDB(){

    try { // Call Web Service Operation


            EMPCOUNTService service = new EMPCOUNTService();
            EMPCOUNTPortType

            port = service.getEMPCOUNTPort();

            SNUMBEREMPCOUNTInput parameters = new SNUMBEREMPCOUNTInput();

            EMPCOUNTOutput result = port.empcount(parameters);

            MyAuthenticator myAuth = new MyAuthenticator("SCOTT","tiger");
            Authenticator.setDefault(myAuth);

            System.out.println("Result = "+result.toString());



    } catch (Throwable e1) {e1.printStackTrace();}

  }

  public static void main(String[] args) throws Exception {

      EMPCOUNT_XDB t = new EMPCOUNT_XDB();
      t.empcountXDB();
      System.out.println("Result = ABCDEFG");

    }



}

Is my authentication wrong?
0
 
MikeOM_DBACommented:

Maybe your issue is as simple as providing the password in the EXACT character case (11g passwords are case sensitive).

Also make sure the user can connect, try login with sqlplus.

Good luck!
0
 
cinglezAuthor Commented:
Thanks for the reply, but that was not the case. It seems to authenticate if I use


((BindingProvider)port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "scott");
((BindingProvider)port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "tiger");

But then it seems to timeout.
0
 
cinglezAuthor Commented:
Authenticated, but still have other problems
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now