I have problems with writing Java client for wshttpbinding web service.
I wsimport-ed .wsdl and i try to
TestService iface = new TestService();
ITestService implmt = iface.getWSHttpBindingITestService();
then i call web service method set
implmt.set("s", 1);
And i get
Exception in thread "main" javax.xml.ws.WebServiceException:
java.net.SocketException: Connection reset
I cannot change server side, it must be as is. So change to basicHttpBinding is not possible (if i change it i don't have any problem but alas)
Client must be made in Java.
Oh ok I solved it. I imported METRO .jar files to build path and moved them to top (to be first)
It is crucial to place those jars on top.
Related
I have the WSDL of a large enterprise web service, which includes several endpoints, out of which I only intend to use one.
I tried generating the Service Client in Visual Studio by adding a Service Reference to the project. The issue is that due to the high number of endpoints available in the service, the generated client code in Reference.cs ended up having more than 1,400,000 lines, and Visual Studio seems to have a hard time handling it (IntelliSense often hangs, sometimes the whole VS crashes), and I imagine the build times will be longer too due to this.
And out of the hundreds of endpoints, I will only use one, and won't need the rest.
Is there a way to generate the Client code from the WSDL only for a certain endpoint, either with the Service Reference GUI of Visual Studio, or with svcutil? Or if not, is there some other straightforward way to do this?
I did not find any way to generate a client for a certain endpoint from the WSDL file. But you can call the service of an endpoint individually through the channel factory.Here is the demo:
EndpointAddress address = new EndpointAddress("http://localhost:8000/GettingStarted/CalculatorService1111");
BasicHttpBinding binding =new BasicHttpBinding();
ChannelFactory<ICalculator> factory = new
ChannelFactory<ICalculator>(binding, address);
ICalculator chanel = factory.CreateChannel();
You need to call that endpoint and pass in the address of that endpoint, define the corresponding binding, and then declare the channel factory. So you can call the method in the service. By using the channel factory you can call any endpoint of a service.
I have a WP8 app and this app needs to consume a WCF service to send/receive data from my server.
I have the service and the app working well in my developer computer, using localhost and VS2013.
Now I installed the WCF service in IIS and the service is working well!
My question is: I want a way to dinamicaly change the address of my WCF service without the need to recompile the app and deploy it!
I've found this peace of code in another thread at SO that I would like to know if it would work in any address that I change in my app dinamycally:
private MyServiceClient GetMyServiceClient(string url)
{
Uri uri = new Uri(url);
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
EndpointAddress address = new EndpointAddress(uri);
MyServiceClient client = new MyServiceClient(binding, address);
return client;
}
My app will run for now just in intranet enviroment, so I don't need a high security level to access my server, the basic httpbinding it's for now good enough.
You can look at putting your wcf configuration into a configuration file. See the post here - http://msdn.microsoft.com/en-us/library/ms733932(v=vs.110).aspx
Also take a look at this link - http://www.codeproject.com/Articles/576820/Basic-Step-by-Step-WCF-WebService
It gives an example of consuming a wcf endpoint that is defined in a config file. It uses a wpf example, but it should be easily adaptable to your scenario.
I would like to build an app in C# that connects to an Apache AXIS web service and performs the following operations via SOAP.
Login in to the server.
POST string data to server
Receive and display server response
Here's the tough part. I do not have access to the server, nor do I know where the .JWS file is located on the server. I was able to get to the WSDL file in my web browser, so I know a "Login" operation exists as well as an operation to take in data.
I have tried accessing the web service via URL, but I keep getting this message:
Hi there, this is an AXIS service!
Perhaps there will be a form for
invoking the service here...
In summary, is there anyway I can connect to this web service when all I have is the URL of the WSDL file? Are web services accessible via URL?
Thank you
Use WCF, and generate client proxies to the web service using the svcutil.exe tool.
running svcutil.exe http://url.to/webservice?WSDL the_wsdl.wsdl /language:C# should generate proxy classes you can use in your C# project, and you'd call the service e.g. like
BasicHttpBinding myBinding = new BasicHttpBinding(); //might not even need these
// 2 lines if you ran svcutil.exe directly on the web service URL
EndpointAddress myEndpoint = new EndpointAddress("http://url.to/webservice");
TestClient client = new TestClient(myBinding,myEndpoint); //the generated classes
// svcutil.exe created
client.SomeOperation(42); // call an SomeOperation of the web service
Thanks for everyone's help. Looking back on this question, I can see how severely confused I was. Here is the solution I followed.
Assuming you know the URL of the WSDL file of the service you wish to connect to then just do the following.
Boot up Visual Studio
On the top toolbar navigate to Data -> Add New Data Source then choose Service in the new dialog
In the address bar, enter the URL of the wsdl file (EXAMPLE: http://server.com/services/displayName?wsdl)
Near the bottom of the dialog, change the namespace to something relevant to the project (EXAMPLE: sampleService)
Now Visual Studio should compile the client proxies for you that you can use to access the web services on your server. To access one of the services, all you need to do is create a new object from the class.
//Example
sampleService.ClassName test = new sampleService.ClassName();
test.displayName("Jack");
See http://msdn.microsoft.com/en-us/library/bb552364.aspx for a starting point
I have a webservice with .NET 1.1 (old school ASMX) and I am creating a client app to connect to it and use its services.
From what I remember from the last time I had used Visual studio -which was 2003 version!- I can add a WebReference to it and easily use it. Tried it . it still works.
but it looks like things have changed in 2008 and now we also have WCF. so I can add it as a Service Reference. but with this new method I could not find a way to create an Instance object to the ASMX service and call its methods... how do we accomplish the same thing with WCF?
Ok. done:
we should create a ServiceSoapClinet . an example from my play app:
using (LatestServiceSoapClient proxy = new LatestServiceSoapClient("LatestServiceSoap"))
{
label1.Text = proxy.Welcome();
}
I am developing a c# desktop application and using a webservies which is developed in a php application when i try to consume that application. I just add web REference of that web service and try to access throught the following code
WebReference.TestWSDL pdl = new testingApp.WebReference.TestWSDL();
string copy = pdl.verify("testing");
it throws the error when i try to call the method verify. the error is
Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/ was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/.
and the web service link was like
http://171.139.101.12/code/index.php/webservice/wsdl
The error you are encountering is informing you that when you invoke the webservice, you are being given the WSDL (Web Service Definition Language) for the service - this is the metadata that describes the service functions, but cannot actually be used to invoke the service. Usually, you access the WSDL by appending either "?wsdl" or "wsdl" to the service URI.
There are two elements to the webservice you are attempting to consume.
The actual service exists at:
http://171.139.101.12/code/index.php/webservice
The metadata describing it, which Visual Studio via wsdl.exe used to generate a proxy, resides here:
http://171.139.101.12/code/index.php/webservice/wsdl
You need to edit the properties of the Web Reference and update the address appropriately. Alternatively, you can alter the properties of the pdl variable, and change the endpoint in code.