cinglez
asked on
Oracle Native Web Services and Axis2
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.PasswordAuthentic ation;
import com.oracle.xmlns.orawsv.bi _demo.fili al_cotacao .FILIAL_CO TACAOServi ceStub;
import org.apache.axis2.client.Op tions;
import org.apache.axis2.transport .http.HTTP Constants;
import org.apache.axis2.transport .http.Http TransportP roperties;
//import javax.xml.ws.BindingProvid er;
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(use r,password .toCharArr ay());
// return auth;
// }
// }
public void filialCOTACAO(){
// MyAuthenticator myAuth = new MyAuthenticator("SCOTT","t iger");
// Authenticator.setDefault(m yAuth);
try { // Call Web Service Operation
FILIAL_COTACAOServiceStub stub = new FILIAL_COTACAOServiceStub( );
Options options = stub._getServiceClient().g etOptions( );
HttpTransportProperties.Au thenticato r auth = new HttpTransportProperties.Au thenticato r();
auth.setPreemptiveAuthenti cation(tru e);
auth.setPassword("bi_demo" );
auth.setUsername("bi_demo" );
options.setProperty(HTTPCo nstants.AU THENTICATE ,auth);
FILIAL_COTACAOServiceStub. SVARCHAR2F ILIAL_COTA CAOInput dados = new FILIAL_COTACAOServiceStub. SVARCHAR2F ILIAL_COTA CAOInput() ;
FILIAL_COTACAOServiceStub. FILIAL_COT ACAOOutput resp = new FILIAL_COTACAOServiceStub. FILIAL_COT ACAOOutput ();
String user = "TESTE";
dados.setUSUARIO$VARCHAR2I N(user);
resp = stub.fILIAL_COTACAO(dados) ;
System.out.println("Respos ta " + 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/Ne tBeansProj ects/FILIA L_COTACAO_ Axis/dist/ lib/mex-1. 5.1.jar
org.apache.axiom.soap.SOAP Processing Exception: Only Characters are allowed here
at org.apache.axiom.soap.impl .builder.S OAP11Build erHelper.p rocessText (SOAP11Bui lderHelper .java:153)
at org.apache.axiom.soap.impl .builder.S OAP11Build erHelper.h andleEvent (SOAP11Bui lderHelper .java:63)
at org.apache.axiom.soap.impl .builder.S tAXSOAPMod elBuilder. constructN ode(StAXSO APModelBui lder.java: 390)
at org.apache.axiom.soap.impl .builder.S tAXSOAPMod elBuilder. createOMEl ement(StAX SOAPModelB uilder.jav a:227)
at org.apache.axiom.soap.impl .builder.S tAXSOAPMod elBuilder. createNext OMElement( StAXSOAPMo delBuilder .java:196)
at org.apache.axiom.om.impl.b uilder.StA XOMBuilder .next(StAX OMBuilder. java:207)
at org.apache.axiom.om.impl.l lom.OMElem entImpl.bu ildNext(OM ElementImp l.java:664 )
at org.apache.axiom.om.impl.l lom.OMNode Impl.getNe xtOMSiblin g(OMNodeIm pl.java:14 1)
at org.apache.axiom.om.impl.t raverse.OM ChildrenQN ameIterato r.findNext ElementWit hQName(OMC hildrenQNa meIterator .java:96)
at org.apache.axiom.om.impl.t raverse.OM ChildrenQN ameIterato r.<init>(O MChildrenQ NameIterat or.java:53 )
at org.apache.axiom.om.impl.l lom.OMElem entImpl.ge tFirstChil dWithName( OMElementI mpl.java:2 70)
at org.apache.axiom.soap.impl .llom.soap 11.SOAP11F aultImpl.g etCode(SOA P11FaultIm pl.java:12 4)
at org.apache.axis2.AxisFault .initializ eValues(Ax isFault.ja va:202)
at org.apache.axis2.AxisFault .<init>(Ax isFault.ja va:196)
at org.apache.axis2.util.Util s.getInbou ndFaultFro mMessageCo ntext(Util s.java:435 )
at org.apache.axis2.descripti on.OutInAx isOperatio nClient.ha ndleRespon se(OutInAx isOperatio n.java:371 )
at org.apache.axis2.descripti on.OutInAx isOperatio nClient.se nd(OutInAx isOperatio n.java:417 )
at org.apache.axis2.descripti on.OutInAx isOperatio nClient.ex ecuteImpl( OutInAxisO peration.j ava:229)
at org.apache.axis2.client.Op erationCli ent.execut e(Operatio nClient.ja va:165)
at com.oracle.xmlns.orawsv.bi _demo.fili al_cotacao .FILIAL_CO TACAOServi ceStub.fIL IAL_COTACA O(FILIAL_C OTACAOServ iceStub.ja va:181)
at FILIAL_COTACAO.filialCOTAC AO(FILIAL_ COTACAO.ja va:56)
at FILIAL_COTACAO.main(FILIAL _COTACAO.j ava:68)
Any ideas?
Thanks
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.PasswordAuthentic
import com.oracle.xmlns.orawsv.bi
import org.apache.axis2.client.Op
import org.apache.axis2.transport
import org.apache.axis2.transport
//import javax.xml.ws.BindingProvid
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(use
// return auth;
// }
// }
public void filialCOTACAO(){
// MyAuthenticator myAuth = new MyAuthenticator("SCOTT","t
// Authenticator.setDefault(m
try { // Call Web Service Operation
FILIAL_COTACAOServiceStub stub = new FILIAL_COTACAOServiceStub(
Options options = stub._getServiceClient().g
HttpTransportProperties.Au
auth.setPreemptiveAuthenti
auth.setPassword("bi_demo"
auth.setUsername("bi_demo"
options.setProperty(HTTPCo
FILIAL_COTACAOServiceStub.
FILIAL_COTACAOServiceStub.
String user = "TESTE";
dados.setUSUARIO$VARCHAR2I
resp = stub.fILIAL_COTACAO(dados)
System.out.println("Respos
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/Ne
org.apache.axiom.soap.SOAP
at org.apache.axiom.soap.impl
at org.apache.axiom.soap.impl
at org.apache.axiom.soap.impl
at org.apache.axiom.soap.impl
at org.apache.axiom.soap.impl
at org.apache.axiom.om.impl.b
at org.apache.axiom.om.impl.l
at org.apache.axiom.om.impl.l
at org.apache.axiom.om.impl.t
at org.apache.axiom.om.impl.t
at org.apache.axiom.om.impl.l
at org.apache.axiom.soap.impl
at org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault
at org.apache.axis2.util.Util
at org.apache.axis2.descripti
at org.apache.axis2.descripti
at org.apache.axis2.descripti
at org.apache.axis2.client.Op
at com.oracle.xmlns.orawsv.bi
at FILIAL_COTACAO.filialCOTAC
at FILIAL_COTACAO.main(FILIAL
Any ideas?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER