error when invoking web services using UTL_DBWS - web-services

I followed the example in Oracle tutorial how to invoke the web service.
When I run it with
l_wsdl_url := 'http://www.oracle-base.com/webservices/server.php?wsdl';
It works fine.
However, if I create my own dynamic web application in Eclipse, and generate the SAME wsdl that oracle presents, and change the code to be:
l_wsdl_url := 'http://localhost:8080/MyProject/services/CalculatorPort?wsdl';
I get an exception:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: error.build.wsdl.model: oracle.j2
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: error.build.wsdl.model: oracle.j2
So I added to the code:
sys.utl_dbws.set_http_proxy('http://localhost:8080');
I get the following exception:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: error.build.wsdl.model: oracle.j2ORA-29532: Java call
terminated by uncaught Java exception: java.lang.IllegalAccessException:
error.build.wsdl.model: oracle.j2ee.ws.commons.tools.api.WsdlValidationExcpetion:
faultCode = PARSER_EXCEPTION error reading file at:
http://localhost:8080/MyProject/services/CalculatorPort?wsdl: http://localhost
The web services runs just fine out of PL/SQL (with soap-ui) tool.
The PL/SQL is sitting behind firewall on a different machine than my localhost application.
What's wrong in the request?

If I understood correctly, what is wrong is the fact that you are trying to call localhost in a different machine than yours. When testing on PL/SQL, please replace localhost by the ip of the machine where the web service is.

Related

BizTalk : Consuming WCF Service - There was a failure executing the response(receive) pipeline

I am creating a sample biztalk application which consumes a WCFService for learning purpose. I had no problem in consuming the WCF Service and using that to in BizTalk Application in which I give an input xml file in the input folder and and an Output xml file is generated in the output folder.
Now I am trying to do give the input to the WCF Service via a sample applcation I am getting an error which says
There was a failure executing the response(receive) pipeline:
"Microsoft.BizTalk.DefaultPipelines.XMLReceive,
Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" Source: "XML disassembler" Send Port:
"******Send Port Name****"
URI: "*********" Reason: No
Disassemble stage components can recognize the data.
I am using the wcf-custom adapter for binding. What could be the error here?
The error you are receiving lets you know that the message you received (indeed, the response) is not valid according to any known schema within your BizTalk application domain. Try and setup WCF tracing/diagnostics to see what exactly your web service is responding. Most likely, if this is a SOAP-bases web service for example, it might be a typed SOAP fault.
Valuable links:
Diagnostic Tracing and Message Logging - https://msdn.microsoft.com/en-us/library/cc185303(v=bts.10).aspx
How to Handle Typed Fault Contracts in Orchestrations - https://msdn.microsoft.com/en-us/library/bb246117.aspx
Best practices for handling web service exceptions in BizTalk Server - http://www.codit.eu/blog/2012/01/13/best-practices-for-handling-web-service-exceptions-in-biztalk-server/

Web service Axis2 client code generation issue

I'm trying the consume a web services built using Axis2, so I have followed this example for creating client code.
I have the endpoint and I'm able to access it through the browser. But trying to generate the client code with:
WSDL2Java.bat -uri <<endpoint>> -o client
throws the exception below:
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:181)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:570)
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:141)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:411)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:525)
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:272)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:99)
... 2 more
What could be the reason for this error?
If you can access the WSDL from a browser but not from the tool in command line then it's possible that your browser uses a HTTP proxy for it's connection while wsdl2java goes straight for the address.
Try setting some JVM parameters for using a proxy, as described in Java Networking and Proxies and if that fails, there is always the option to download the WSDL with the browser and run wsdl2java with the locally downloaded file.

Weblogic deployed application calling webservice not working, but in Tomcat deployment works fine

I am facing problem in calling webservice in my project which is deployed in weblogic, but the same application works fine in tomcat deployment.
Error:
javax.xml.ws.WebServiceException: Failed to access the WSDL at: XXXservices?wsdl. It failed with:
Response: '401: Unauthorized' for url: '://xxx.xxx.xxx.xx:8111/xxx/services?wsdl'.
But same works fine in Tomcat deployment.
I search in the net. people said, we need to force weblogic to use sun http handler, so written something like below. but its not works for me.
sun.net.www.protocol.http.Handler handler = new sun.net.www.protocol.http.Handler();
URL wsdlURL = new URL(null, "http://xxx.xxx.xxx.xx:8111/xxx/services?wsdl", handler);
HttpResponse code 401 denotes that authorization has been refused for the credentials. By default, Weblogic has basic authentication enabled. You can disable it as follows
Setting the enforce-valid-basic-auth-credentials Flag
To set the e enforce-valid-basic-auth-credentials flag, perform the following steps:
Add the <enforce-valid-basic-auth-credentials> element to config.xml within the <security-configuration> element :
<enforce-valid-basic-auth-credentials>
false
</enforce-valid-basic-auth-credentials>
Start or restart all of the servers in the domain. Please go through this link for good understanding

asp.net (asmx) webservices not working in windows phone 7

I am developing a wp7 app that consumes a simple web service written in asp.net
The web service is working fine in desktop application (written in c#) (also tested in web browser and is working fine) but it is not working in wp7.
Following is the code I am using in wp7 to call the webservice
BookService.BooklocationSoapClient client = new BookService.BooklocationSoapClient();
client.BookListCompleted += new EventHandler<BookService.BookListCompletedEventArgs>(client_BookListCompleted);
client.BookListAsync(dId);
void client_BookListCompleted(object sender, BookService.BookListCompletedEventArgs e)
{
Debug.WriteLine(e.Result);
}
and following is the exception I am getting
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.ServiceModel.FaultException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.FaultException' occurred in System.ServiceModel.dll
Also, I am getting the following message
Server was unable to process request. ---> Length cannot be less than zero.
Parameter name: length
Seems like you try to call local web service on your developer machine, which not allowed by
windows phone emulator.
Try call any public web service available in internet, as example weather forecast

Handle WCF exceptions from webservice proxy

I have a WCF service (.NET 4) hosted in IIS. My service contract has one method with:
[FaultContract(typeof(string))]
My service implementation for that method validates input parameters and may throw an exception like this:
if (string.IsNullOrWhiteSpace(siteName)) { throw new FaultException("siteName is required."); }
The consumer program of this service is a .NET 2 console application. In this app I generated the webservice proxy by right clicking "References" and "Add web reference".
When I try to call the service method from the client app, by sending an invalid siteName, I get back a 503 Service Unavailable exception, instead of a FaultException with the custom error message.
How can I make the FaultException, with the custom error message, propagate to the client program?
UPDATE:
The exception I get in the client application is this:
System.ServiceModel.ServerTooBusyException:
The HTTP service located at
http://www.example.com/services/myservice.svc
is too busy. ---> System.Net.Web
Exception: The remote server returned
an error: (503) Server Unavailable.
at
System.Net.HttpWebRequest.GetResponse()
at
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpCha
nnelRequest.WaitForReply(TimeSpan
timeout) --- End of inner exception
stack trace ---
The problem was being caused by a custom HTTP module in our web project. So it was not exactly a WCF problem, but a problem specific to our solution. Thanks!