?
Solved

Oracle Native Web Services and Axis2

Posted on 2011-05-03
2
Medium Priority
?
806 Views
Last Modified: 2012-05-11
Hi.

I've created the Stubs from an Oracle XMLDB native web service (using the auto generated WSDL). For that, I've used wsdl2java (Axis2). Then I created a simple java client:



//import java.net.Authenticator;
//import java.net.PasswordAuthentication;


import com.oracle.xmlns.orawsv.bi_demo.filial_cotacao.FILIAL_COTACAOServiceStub;
import org.apache.axis2.client.Options;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;


//import javax.xml.ws.BindingProvider;

class FILIAL_COTACAO {

//  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 filialCOTACAO(){

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

      try { // Call Web Service Operation

        FILIAL_COTACAOServiceStub stub = new FILIAL_COTACAOServiceStub();

        Options options = stub._getServiceClient().getOptions();
        HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
        auth.setPreemptiveAuthentication(true);
        auth.setPassword("bi_demo");
        auth.setUsername("bi_demo");
        options.setProperty(HTTPConstants.AUTHENTICATE,auth);

        FILIAL_COTACAOServiceStub.SVARCHAR2FILIAL_COTACAOInput dados = new FILIAL_COTACAOServiceStub.SVARCHAR2FILIAL_COTACAOInput();
        FILIAL_COTACAOServiceStub.FILIAL_COTACAOOutput resp = new FILIAL_COTACAOServiceStub.FILIAL_COTACAOOutput();
               
        String user = "TESTE";
       
        dados.setUSUARIO$VARCHAR2IN(user);

        resp = stub.fILIAL_COTACAO(dados);

        System.out.println("Resposta " + resp.getRETURN());
        System.out.println("TESTE");

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

    }

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

      FILIAL_COTACAO t = new FILIAL_COTACAO();
      t.filialCOTACAO();
    }



}


When I execute it, it returns  me:


[INFO] Deploying module: metadataExchange-1.5.1 - file:/Users/CInglez/MSV/NetBeansProjects/FILIAL_COTACAO_Axis/dist/lib/mex-1.5.1.jar
org.apache.axiom.soap.SOAPProcessingException: Only Characters are allowed here
      at org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.processText(SOAP11BuilderHelper.java:153)
      at org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.handleEvent(SOAP11BuilderHelper.java:63)
      at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:390)
      at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:227)
      at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:196)
      at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:207)
      at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:664)
      at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:141)
      at org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator.findNextElementWithQName(OMChildrenQNameIterator.java:96)
      at org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator.<init>(OMChildrenQNameIterator.java:53)
      at org.apache.axiom.om.impl.llom.OMElementImpl.getFirstChildWithName(OMElementImpl.java:270)
      at org.apache.axiom.soap.impl.llom.soap11.SOAP11FaultImpl.getCode(SOAP11FaultImpl.java:124)
      at org.apache.axis2.AxisFault.initializeValues(AxisFault.java:202)
      at org.apache.axis2.AxisFault.<init>(AxisFault.java:196)
      at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:435)
      at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
      at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
      at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
      at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
      at com.oracle.xmlns.orawsv.bi_demo.filial_cotacao.FILIAL_COTACAOServiceStub.fILIAL_COTACAO(FILIAL_COTACAOServiceStub.java:181)
      at FILIAL_COTACAO.filialCOTACAO(FILIAL_COTACAO.java:56)
      at FILIAL_COTACAO.main(FILIAL_COTACAO.java:68)


Any ideas?

Thanks
0
Comment
Question by:cinglez
  • 2
2 Comments
 

Accepted Solution

by:
cinglez earned 0 total points
ID: 35692203
There was a "$" character in one of the Oracle parameters.Removing it solved the problem.
0
 

Author Closing Comment

by:cinglez
ID: 35692206
Solved doing my own testing
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
These instructions are based on installing Owncloud on your new raspberry pi connected with a usb HDD. What do you need Part A? A Raspberry Pi, model B. A boot SD card for the Raspberry Pi. A usb HDD An Ethernet cable to connect to the lo…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question