General How to call Java Web Services (wsdl) in .net
am calling some web service which is developed in java
I have added web reference it is doing god but when I call any function of any class in service am getting error
Code:
The request failed with HTTP status 401: Unauthorized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[WebException: The request failed with HTTP status 401: Unauthorized.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +551137
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204
com.rephero.billing.WebServicesSessionLocalService.getUserId(String in0) +79
JBillingWebReff.Page_Load(Object sender, EventArgs e) +47
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
________________________________________
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
The username and password is given correct what the problem Please help me any body
Re: General How to call Java Web Services (wsdl) in .net
Show the code you're using to call this. How is it referenced?
Did you look at the http://java/web/service?wsdl as well?
Re: General How to call Java Web Services (wsdl) in .net
Thanks for your Reply
These are the steps followed to add reference
URL: http://billing.rephero.com/jboss-net...s/billing?wsdl prompts for “Axis basic authentication” the screen looks as below
Step 2: in Axis basic authentication dilog box i entered username and password and clicked ok after that it asks for some confirmation
Step 3: Confirmation message is “The server need to authenticate your credentials will be sent to the server in clear “text”
Step 4: After confirming yes am getting “discovery credentials” dialog box It accepts username password and domain name. If i give domain name reference is not getting added but without giving a domain name if clicked Ok then it adds reference successfully.
This is what the code we are using to invoke the jBilling functions
Code:
Imports JBillingWebReff
Imports com.rephero.billing
Imports com.rephero.billing.UserWS
Partial Class JBillingWebReff
Inherits System.Web.UI.Page
Dim service As New WebServicesSessionLocalService()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim userId As Integer = service.getUserId("Web")
If userId > 0 Then
Dim userData As UserWS = service.getUserWS(userId)
End If
End Sub
End Class
These are the steps followed to add reference
URL: http://billing.rephero.com/jboss-net...s/billing?wsdl prompts for “Axis basic authentication” the screen looks as below
Step 2: in Axis basic authentication dilog box i entered username and password and clicked ok after that it asks for some confirmation
Step 3: Confirmation message is “The server need to authenticate your credentials will be sent to the server in clear “text”
Step 4: After confirming yes am getting “discovery credentials” dialog box It accepts username password and domain name. If i give domain name reference is not getting added but without giving a domain name if clicked Ok then it adds reference successfully.
This is what the code we are using to invoke the jBilling functions
Imports JBillingWebReff
Imports com.rephero.billing
Imports com.rephero.billing.UserWS
Partial Class JBillingWebReff
Inherits System.Web.UI.Page
Dim service As New WebServicesSessionLocalService()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim userId As Integer = service.getUserId("Web")
If userId > 0 Then
Dim userData As UserWS = service.getUserWS(userId)
End If
End Sub
End Class
Thank you
Vuyiswa
Re: General How to call Java Web Services (wsdl) in .net
You may need to pass the credentials...
service.Credentials = New NetworkCredentials(........)
Re: General How to call Java Web Services (wsdl) in .net
ya but i don no how to add credentials can u please help how to add credentials
one thing the web service is in different server but am working in another server so
and am not directly working in server
just developing the code and uploading the component to server
Please help me how to add credentials.
Re: General How to call Java Web Services (wsdl) in .net
I just showed you. You should be able to set the .Credentials property.
service.Credentials = new NetworkCredentials("user", "pass")
Re: General How to call Java Web Services (wsdl) in .net
HI mendhak
Thank you sir now the error is get fixed
Now I get it but am getting another error
The request failed with HTTP status 505: HTTP Version Not Supported.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The request failed with HTTP status 505: HTTP Version Not Supported.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[WebException: The request failed with HTTP status 505: HTTP Version Not Supported.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +551137
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204
com.rephero.billing.WebServicesSessionLocalService.getUserId(String in0) +79
JBillingWebReff.Page_Load(Object sender, EventArgs e) +102
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
I think the service is not supporting for http: let me check.
but thanks u again
Thanks
Re: General How to call Java Web Services (wsdl) in .net
A 505 is supposed to contain the reason for not supporting the request. Oh well, that's the world of Java for you. Start stepping through your code. Find out which line the code errors out on. Is it getUserId() or getUserWs?
Re: General How to call Java Web Services (wsdl) in .net
hi mendhak
i think it is the error am getting becouse the service is not Supporting here the document they have given
Notice that there is already a section to force HTTPS, but it is commented. Uncomment
the section to force HTTPS:
<!--
This is needed to secure web service over SSL
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
-->
It will use the SSL certificate that tomcat is using to secure the standard web client.
Thanks
Re: General How to call Java Web Services (wsdl) in .net
hi Sir
I Checked in https but their also am getting same error
when I remove all the code except credential then I did not get any error after that I changed my privies code to
Imports JBillingWebReff
Imports com.rephero.billing
Imports com.rephero.billing.UserWS
Imports com.rephero.billing.WebServicesSessionLocalService
Partial Class JBillingWebReff
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim service As WebServicesSessionLocalService = New WebServicesSessionLocalService()
Dim userName As String = "jbajin"
service.Credentials = New Net.NetworkCredential("webapp", "r3ph3r0-b1ll1ng")
Dim userIdParams As String = "jbajin"
Dim result As String
result = service.getUserId(userIdParams)
Response.Write(result)
End Sub
End Class
this is first time am working with this type of web service(java) please help me
2 Attachment(s)
Re: General How to call Java Web Services (wsdl) in .net
Hmm, looking at the wsdl, I see that it's not SOAP, which is the method that you're attempting to reference. It's got complexTypes. Thank goodness for standards.
I am not sure why you are getting those specific errors, but from what I can tell, you will not be able to reference the web service and use it in your application like this.
I did try using the wsdl utility to do this. I've attached the output I got.
My command was
Code:
C:\Program Files\Microsoft Visual Studio 8\VC>wsdl.exe http://billing.rephero.com/jboss-net/services/billing?wsdl /out:c:\myaxis.cs /username:XXXXXXXXX /password:XXXXXXXXXXXXXX > c:\output.txt
I've attached the output generated by the tool as well as the proxy class generated.