PHP WebService cannot be used in VS2012 - web-services

I have developed a WebService in PHP using SoapDiscovery class made by Braulio José Solano Rojas but with some adjustments made by me in order to support complex types.
The problem is that I can use the webservice in PHP client, but not in VS 2012. When adding the Web reference, Web Service methods are detected and I can add the reference correctly, but when I try to use it, intellisense does not show it, so that I cannot instantiate it and do nothing. I can, however, use a Webservice that does not use complex types.
The WSDL is at: http://feriados.servicios.desytec.com/feriados?wsdl
Please advise me.

Related

SOAP through C++ Builder

I'm trying to consume my SOAP web service in my C++ programm. I'm using in-build wizard to generate interaction code automaticaly using my wsdl. When I call non parameterized method everything is OK, but when I trying to call web method with parameter, I get error linked with namespace. I think I need to override onBeforeExecute method of HTTPRIO to replace some bad tags, but I could not find any useful HTTPRIO documentation or examples wrote on C++. Can anybody give me a link dedicated to HTTPRIO applying with SOAP. Or may be someone already faced with transmitting parameters problem and knows more elegant solution?
Unmarshaling error: unexpected element(uri:"/*my_service_namespace*/", local:"/*parameter_name*/"). Expected element are <{}/*parameter_name*/>

javax.ejb.Stateless class undefined

I am currently trying to implement a web-service assignment given by my college.
My Assignment is..,
Consider a case where we have two web Services- an airline service and
a travel agent and the travel agent is searching for an airline.
Implement this scenario using Web Services and Data base.
For that as a newbie I tried to follow the steps given in this link.
I opened the Netbeans beta 2, and exactly followed the steps as given in that link.
But while trying the steps,
Deploying and Testing the Web Service, I tried to run the CalculatorWSApplication, I noticed that javax.ejb.Stateless is undefined.
And I have three questions,
I have a basic knowledge of , JSP, HTML, WEBSERVICE. Please give me some basic idea/basic schema of the assignment such that I could proceed with the next steps and implementation.
How could I get rid-off from the missing ejb file.
Generally .java files will refer to the libraries present in jre and why in this program, CalculatorWS.java refers in this path C:\users\MuthuGanapathy\.netbeans\7.0beta2\var\cache\index\s3\java\14\gensrc\javax\
Let me try to answer your questions:
First of all: You don't really need knowledge of JSP and HTML for creating WebServices. If you are interested in additional knowledge rather have a look in subjects like SOAP, WSDL or XML (on which SOAP and WSDL files are based). You can find good informations at w3schools.
As said in your assignments requirement you'll have combine your service with a database, therefore you'll have to face the fact that WebServices aren't able to send every kind of data. For example, if you intend to use some kind of JPA you wont be able to send entities between Client and Server via WebService easily (though its possible).
For the reason of that my approach would be to send simple datatypes between client and server and, on server side, build my complex objects.
This would force me to code at least 3 classes (one for each webservice and one for communication with the database).
Airline WS:
#WebService
public class Airline {
#WebMethod
public String stuffToDo {
// do your stuff
persistOrSelect(complexObject);
return "success";
}
private boolean persistOrSelectData(Object complex) {
// Database stuff here
DBdao.doStuff(complex);
return true;
}
}
TravelAgent WS:
// same structure as shown above
DB class:
public class DBdao {
public static doStuff(Object complex) {
// get DB connection and INSERT, SELECT, UPDATE
}
}
In this scenario you didn't even have to use a class out of the javax.ejb package but I understand that this could be necessary :).
I don't really use Netbeans and therefore I can only speculate. I think that your problems 2.) and 3.) relate to each other.
The javax.* package normally is located in your JDK and should be specified in your IDE inside the server library/target runtime your using.
Do you have assigned the server library to your project?
Have you tried to point your Netbeans installation to your JDK path as shown here and here?
It could also be possible that your project do not have a reference to the Java System library.
Last but not least:
There are several ways for testing your webservice:
You use Netbeans therfore I assume that you deploy your project on an Glassfish server.
After deployment you can navigate to your project inside the admin gui and click the link pointing to view endpoints. In the next window your able to either follow a link pointing to the generated WSDL or to a tester
You can write your own client by either following the tutorial provided or, for a more general approach you can use this.
Use soapUI for testing (it's available as standalone application or as IDE plugin)
I hope this helpes, have Fun!

How to call a Rest Service in C++?

I want to call a rest service written in WCF (which can support both XML and JSON Web Message Formats) from my C++ application.
What is the best solution to achieve this ? I have seen some utilities (gsoap) which create proxy classes for you to be used to call web services.
Can I achieve the same functionality without using any intermediate utility ? As its a rest service and it works using GET/PUT functions which are basic HTTP functions, is there any C++ library/Solution which could be used to invoke these function directly from a c++ application ?
On Linux, you probably could use curl library (and I guess it is ported to Windows). Curl is a library providing HTTP client functionality to a C or C++ program.
Use Casablanca. This should be helpful for people looking for this answer in 2013. CURL is perfectly appropriate but if you're doing C++ in Windows and using MS stuff, Casablanca seems fit.
Hope the following articles might be of help to you
1. Accessing an XML Web Service Using C++
2. SOAP client for C++
I tried gsoap myself but it became difficult to maintain cross platform versions of my app.
Instead i went the HTTP request route.
For cross platform and C++ i found this Call Rest Web Services from C++
If XML serialization with your REST approach is really not needed then curl is perfect to use. However, if you want type-safe XML serialization in C or C++ then it would become cumbersome to use curl, since you will have to use something that runs on top of curl to process XML such as with a DOM parser (slow and not type safe). If you have a WSDL, then I recommend gSOAP 2.8 which provides integrated REST and XML serialization capabilities (and JSON when you need it).

Web Service References & C# 4.0 Default Values

I've just started to use VS2010 and with it comes c# 4.0.
I have since been using the default values for some of my methods, which has allowed me to remove some overloads that performed this operation.
My problem is as follows:
I have a library project that has several classes that I use for various things throughout several other projects. The default values work well here.
Another project is a web service that I use to perform some tasks on a remote server. No errors are shown (or warnings) when I compile this project that the above methods won't work. It compiles fine.
However, when I add this service to another project as a Service Reference, it doesn't seem to see that the method has default values and so complains I am not supplying enough arguments.
I re-deployed my service and updated the service reference, but it is still the same. I also just noticed that a previously working method that uses an 'out' argument (i.e.e MyMethod(out String arg1, String arg2)) doesn't seem to work either now.
Any suggestions? I'm not aware that I have changed any config settings that would do this, so I assume it must be C# 4.0. Having said that, the out argument was working with 4.0 last week :S
Thanks for any help offered...
Cheers
Neil
I wouldn't be surprised to hear that default values specified in a web service aren't reflected in the proxy code generated by Visual Studio. You could create your own proxy layer of course, which would be very simple - but you'd need to update it every time you changed the web service.
If you have a look at the WSDL for your service, does that indicate the default values? It could also be that there's a switch somewhere in the generator to generate optional parameters or not (for compatibility with C# 3).
The out parameter is potentially a different matter entirely - what error are you getting?

Consuming a Web Service written in VS2008

I've got a Web Service written using C# in Visual Studio 2008 (I've also written it in VS 2005).
I can write a test windows form app to consume the service no problem.
The problem I have is consuming it from C#/VS2003 (or php which is my real problem). It just gives me the error:
"Cannot implicitly convert type 'TestIntel.WebIntel.GetSitesResponseGetSitesResult' to 'System.Data.DataTable"
The Web mthod does return a DataTable; as I said this works fine if the consumer was built in VS2005/2008. What gives?
In order to consume a DataTable, the calling points (php and .net 1.1) need to know how to deserialize it into usable object.
This means that they would have to have a similiar object that the data can be deserialized into.
Obviously, PHP can't do that. And the reason for the .net 1.1 error is that the DataTable object changed quite a bit between 1.1 and 2.0. In fact, Microsoft says that the .Net 1.1 datatable object is BY DESIGN not supposed to be serialized through a web service. ( [http://support.microsoft.com/kb/306134][1] )
If you are looking for a real cross language way of doing this then you need to serialize your response into a standard XML object. Which could be parsed correctly by any language. This is a little more work, but results in a usable service.