Hello,
I'm trying to a Acces a webservices from a form(9i).
With Jdeveloper 9i I created a Web service stub?sketelton for the next URL:
http://www.omegahat.org/SSOAP/examples/CurrencyExchangeService.wsdl.xml
Here is a part of a package that's created by Jdeveloper
package oracle.forms.demos.webservice;
import oracle.soap.transport.http.OracleSOAPHTTPConnection;
import java.net.URL;
import org.apache.soap.Constants;
import org.apache.soap.Fault;
import org.apache.soap.SOAPException;
import org.apache.soap.rpc.Call;
import org.apache.soap.rpc.Parameter;
import org.apache.soap.rpc.Response;
import java.util.Vector;
import java.util.Properties;
/**
* Generated by the Oracle9i JDeveloper Web Services Stub/Skeleton Generator.
* Date Created: Mon Nov 10 09:33:25 CET 2008
* WSDL URL: http://www.omegahat.org/SSOAP/examples/CurrencyExchangeService.wsdl.xml
*
* Returns the exchange rate between the two currencies
*/
public class CurrencyExchangeServiceStub
{
public String endpoint = "http://services.xmethods.net:80/soap";
private OracleSOAPHTTPConnection m_httpConnection = null;
public CurrencyExchangeServiceStub()
{
m_httpConnection = new OracleSOAPHTTPConnection();
}
public Float getRate(String country1, String country2) throws Exception
{
Float returnVal = null;
URL endpointURL = new URL(endpoint);
Call call = new Call();
call.setSOAPTransport(m_httpConnection);
call.setTargetObjectURI("urn:xmethods-CurrencyExchange");
call.setMethodName("getRate");
In my form I imported the java class.
The wrote the next routine to trigger the webservice:
PROCEDURE wbpd
IS
jo ora_java.jobject;
rv ora_java.jobject;
ex ora_java.jobject;
l_fout varchar2(2000);
BEGIN
jo := CurrencyExchangeServiceStub.new;
--
--This will get the exchange rate from US Dollars to UK Sterling.
--
rv := CurrencyExchangeServiceStub.getRate(jo,'USA','GBP');
message (float_.floatValue(rv));
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;
l_fout := Exception_.toString(ex);
insert into my_error ( tekst )
values
( l_fout );
commit;
END;
When I run the form excpetion ORA_JAVA.EXCEPTION_THROWN is raised.
The next error is discovered:
[ SOAPException: faultCode=SOAP-ENV:IOException;
msg=services.xmethods.net;
targetException=java.net.UnknownHostException: services.xmethods.net
]
I am behind a firewall.
Does anyone know why I get the error and what to do to solve the problem?
Thanx,
Jeroen de Jong @ OSA it
The Netherlands