Problem adding Java SOAP web services to an asp.net/C#.net project RSS

Hi, I'm using vs2013 , asp.net and C#
Do I need to add the Java SOAP web services differently than when simply adding a ASP.net web api?

The API requires credential so I enter the service account credential then it just repeatedly popping up the Web Discovery Service dialog as attached file, and asked is I want to continue.  I clicked yes, enter the credential again and it just goes right back to the same dialog.  What's going on here?  It doesn't complaint that it's credential, instead is just goes in a loop of keep asking me to enter credential.

Okay, I finally see the Error detail in the Add Service Ref dialog.  It says the following.  Does this mean the credential I entered is invalid?  

"Metadata contains a reference that cannot be resolved: 'https://xxxxx.xxx.xxx.xxx/yyyy'.
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm="XXXXXX API"'.
The remote server returned an error: (401) Unauthorized.
If the service is defined in the current solution, try building the solution and adding the service reference again."

This is what the 3rd party vendor says about their APIs, below. Do I have to do anything in the web.config file to be able to add these references? Like discussed here, http://stackoverflow.com/questions/1365163/can-not-call-web-service-with-basic-authentication-using-wcf


The API service endpoint employs the use of Simple Object Access Protocol (SOAP, version 1.1) as the transport specification and Hypertext Transfer Protocol Secure (HTTPS) as the transport protocol. XML is used as the data exchange format to ensure the validation of structured message data conforms to the specification of the API. The API also employs the use of Message Transmission Optimization Mechanism (MTOM), a method for efficiently sending/receiving binary data, utilized when exchanging documents.

The XXXXX API makes available a Web Service Description Language (WSDL), published through its service endpoint, which describes the manner in which the service may be called, details the available service operations, and specifies the message structures.
A client application must be built in congruence with the service specification as provided by the WSDL. Any number of technologies may be used to build the client.



Thank you.
lapuccaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
There are two different ways to add a service reference in Visual Studio 2013--Service Reference and classic Web Reference

Steps to Add Web Reference dialog:

1) Select Add Service Reference from right-clicking on project Reference node in Solution Explorer

2) Click on the Advanced button

3) Click the Add Web Reference button at the bottom of the dialog

Another way, if the service supports cookies, would be to access the service in browser, and log in with the proper credentials.

Also, is there a URL for the WSDL?  You could add from the WSDL URL, and then override the GetWebRequest to add the basic authentication headers:

protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
    var req = base.GetWebRequest(uri);
    req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes("username:password")));
    return req;
}

Open in new window

0
lapuccaAuthor Commented:
Hi, thank you for the reply.
I tried using the Add Service and got the error message as stated in my question post. I then tried adding the web service yesterday as well ,the dialog said it generate code based on .net framework 2.0, does it matter that I'm in VS2013?

All below occurred in the dialog of "Add a Web Reference".
I clicked to "Add a Web Referemce" and I got the same 404 error, "The requested resource (/yyy) is not available.", or not found, after I repeated enter my credential and eventually had to click on the Cancel button otherwise it keeps asks for credential.  Why is that so?

I then use the wsdl url, 'https://xxxxx.xxx.xxx.xxx/yyyy/api?wsdl '.  It asked me to enter credential a couple of times while keep dispalying the Security warning dialog, attached, several times.  After all that, it then does display all the methods of the web service.  However, can you take a look at the warning message on top of the screen about security.  When I clicked on that warning, I have option to "allow blocked content" or "Open desktop".  If I select the "allow blocked content" option then the list of methods turns into XML format.  Does it matter or not if I allow the content?

The web service, with the name I gave it, is now listed under a Web Reference folder.  I tried adding the "using" statement at top of my cs code and it can't find it.  However, inside of my Page_Load event, I can reference the Web Reference Name that I gave it.  But, in the code the intellisense only shows Delegates and Classes, no methods that I can call.  Those methods I saw when adding this web reference does not show up at all!  So frustrating!

Also, what's the proper way to add references?  What's the difference when I add using the url without the /api?wsdl, which I think is the wsdl file.

Thank you.
Secruity-Warning.jpg
add-wsdl.jpg
0
Bob LearnedCommented:
Without specifics about the web service, it is more difficult to suggest a course of action.

1) The security warning means that the WSDL has URLs that are not HTTPS:

2) The "To help protect your security...active content" warning suggests that there is script in the WSDL.  I haven't worked with web services that had "active content" before.  I believe that Visual Studio uses Internet Explorer, which has a setting to allow active content.  I am not sure that allowing active content will help you.

3) What version and service pack release level are you using with Visual Studio 2013?
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

lapuccaAuthor Commented:
My VS 2013 info
Microsoft Visual Studio Ultimate 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00057

Installed Version: Ultimate

I followed from steps 2 of Add Web Services, http://www.codeproject.com/Articles/32313/How-to-invoke-Java-web-service-in-ASP-net-using-C 
But I can't reference the web service with using or in my code to access the methods.  Maybe I need to use an older version of VS?
0
Bob LearnedCommented:
"Maybe I need to use an older version of VS?"
The classic Add Web Reference dialog available through the Advanced button, is the same as older versions of Visual Studio (the version shown in the CodeProject screen shot).

Figure 15:  Add Web Reference Dialog
http://www.codeproject.com/KB/java/Invoke_Java_WS_In_CS/15.CreateWebServiceClientVS2008Window.png


Try these steps (untested):

1. Visit the service description/WSDL document in external browser and save the WSDL document to local file system.  And add web reference against the local saved WSDL document in Visual Studio.

2. Use the WSDL.exe command utility in .net framework to create web service client proxy externally.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lapuccaAuthor Commented:
I had to instantiate a proxy class and then the intelligent would expose all methods and parameters...   Right, the vendor wasn't nice enough to share which class I need to instantiate but I found it/guessed it.  Thank you for all your help.

The server is refusing the request/connection.  I need to open another question about passing credential here.  Thank you.
0
Bob LearnedCommented:
If the web service is using Basic Authentication, you need to pass them in, and I showed you that code earlier:

protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
    var req = base.GetWebRequest(uri);
    req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes("username:password")));
    return req;
}

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WCF

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.