Link to home
Start Free TrialLog in
Avatar of cinglez
cinglezFlag for Brazil

asked on

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

    }



}
Avatar of cinglez
cinglez
Flag of Brazil image

ASKER

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?

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!
ASKER CERTIFIED SOLUTION
Avatar of cinglez
cinglez
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cinglez

ASKER

Authenticated, but still have other problems