Search This Blog

Showing posts with label Web-Services. Show all posts
Showing posts with label Web-Services. Show all posts

Tuesday, March 19, 2013

Asynchronous Web Service Calls over HTTP with the .NET Framework

very informative article , contains description and several implantation Asynchronous Web Service Calls over HTTP with the .NET Framework: "Asynchronous Web Service Calls over HTTP with the .NET Framework"

on the same subject

Calling Web Services Asynchronously 



Saturday, March 16, 2013

AXIS C++ - starter kit for client on windows- WS from C++

To call Webservice from C++ (VC6 in may case) consider using AXIS C++ - gSoap is also a good option.

before starting your code , its very important to set the axis c++ correctly, i get many "system exception" until i figure out that i need to set the environment  properly.

after downloading your version  (axis-c-1.6b-Win32-trace-bin) and extract it.
set the this environment  variable:
  • AXISCPP_DEPLOY=D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\ -- [ your path]
  • add %AXISCPP_DEPLOY%\bin to your PATH.
  • download  - xerces 2.2  , grab the dll from the bin directory and put it in the %AXISCPP_DEPLOY%\bin directory.
  • Create file axiscpp.conf at %AXISCPP_DEPLOY%
in the file set the next rows - use full path:
#ClientLogPath is for axis trace - leave empty in case you dont want
ClientLogPath:D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\logs\AxisLog.txt
XMLParser:D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\bin\AxisXMLParserXerces.dll
Transport_http:D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\bin\HTTPTransport.dll
Channel_HTTP:D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\bin\HTTPChannel.dll
Channel_HTTP_SSL:D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\bin\HTTPSSLChannel.dll

you are done - its configured properly.
to create your C++ classes from WSDL:
  • get the wsdl 
  • open cmd windows
  • set the classpath 
    • e.g set CLASSPATH=D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\lib\axis\wsdl2ws.jar;D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\lib\axisjava\axis.jar;D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\lib\axisjava\commons-discovery.jar;D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\lib\axisjava\commons-logging.jar;D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\lib\axisjava\jaxrpc.jar;D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\lib\axisjava\saaj.jar;D:\MyStuff\axis-c++\axis-c-1.6b-Win32-trace-bin\lib\axisjava\wsdl4j.jar
  • run the command 
    • java org.apache.axis.wsdl.wsdl2ws.WSDL2Ws any_wsdl.wsdl -lc++ -sclient
you should see your header/cpp files in the directory.

happy coding 
Yaniv Tzanany

Sunday, February 27, 2011

Consume C# DataSet from .Net webservice

Hi
you wish to consume DataSet from .NET webservices , anyway i could not find an easy way to do it , as you do it within c# code, you must deal with XML parsers.
any way, a very good explanation and description could be found here Web Services and DataSets.

In short .. it is most recommended to expose the results as array of objects ,when you want your Java consumer be happy.
.... i used axis 2 to generate webservice proxies .

good luck
Yaniv Tzanany

Monday, November 15, 2010

How to consume WCF service from Java - step by step

Here is a step by step sample how to consume WCF service from java.

WCF in VS.NET (2008 in my case):
create a new project
file->new->project->web->wcf service application
leave the default settings as is , a new WCF service created by the wizard called Service1.svc.
press F5 -> make sure you can see the service page http://localhost:2813/Service1.svc and his wsdl file
http://localhost:2813/Service1.svc?wsdl.

to connect from java to WCF service we have to change the binding type from the default "wsHttpBinding" to "basicHttpBinding".
to do that , edit the Web.config file
change the end point to somthing like this :
<endpoint address="" binding="basicHttpBinding" bindingconfiguration="Binding1" contract="WcfService1.IService1"> </endpoint>

add the next binding section ( you can change it as you like)
<bindings>
<basicHttpBinding>
<binding name="Binding1"
hostNameComparisonMode="StrongWildcard"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00"
maxReceivedMessageSize="65536"
maxBufferSize="65536"
maxBufferPoolSize="524288"
transferMode="Buffered"
messageEncoding="Text"
textEncoding="utf-8"
bypassProxyOnLocal="false"
useDefaultWebProxy="true" >
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
press F5 -> make sure you can see the service page after the changes  http://localhost:2813/Service1.svc and his wsdl file http://localhost:2813/Service1.svc?wsdl

JAVA side:
open cmd  window
cd to your axis2/bin directory  , cd C:\Program Files\Apache Software Foundation\axis2-1.5.2\bin
create directory test in the bin folder , mkdir test.
run the next batch file from your bin directory
wsdl2java.bat -o test -uri http://localhost:2813/Service1.svc?wsdl
the above command should generate the java stub to connect to your wcf service.
Service1CallbackHandler.java and Service1Stub.java.

add those file into your java test program and create your test function.
public static void CallWCFService()
{
try {
Service1Stub srv1 = new Service1Stub();
srv1._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,Boolean.FALSE);
Service1Stub.GetData data = new Service1Stub.GetData();
data.setValue(44);
Service1Stub.GetDataResponse reposne = srv1.getData(data);
System.out.println(reposne.getGetDataResult());
} catch (AxisFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

if you will remark the yellow line (enable the chunk), you will get the
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
when i disabled the chunk , it works perfect.

i would like to say a special thanks to Yaron Naveh , that guide & helped me to get this works,Yaron have a very informative blog on this subject too, thanks Yaron !!!

From Microsoft article (http://msdn.microsoft.com/library/ee958158.aspx)

“For communication with the Java EE-based reservation application, a binding that uses standard SOAP on the wire is required. If the application and the platform it runs on support some or all of the WS-* specifications, the endpoint used by this client might choose WsHttpBinding. This would allow reliable, secure, and transactional communication between the two applications.
If this application and the platform it runs on support only standard SOAP matching the WS-I Basic Profile, however, the endpoint it uses to access the rental car reservation application would use BasicHttpBinding. If transport security is required, this binding could be configured to use HTTPS instead of plain HTTP.”

enjoy
Yaniv Tzanany

Sunday, November 14, 2010

Rampart FAQ and Web services stuff

Rampart = WS-Security module of Axis2.
in this blog you can find a very good FAQ about Rampart module , from basic to advanced stuff.
this link can be useful too , http://blog.rampartfaq.com/.
great blog on Web Services Security, Interoperability and Performance - WCF, Axis2, WSIT
enjoy

Sunday, March 8, 2009

Axis Web services with XML Schemas

if you would like to develop AXIS web services with validation schema, you can find here a very good tutorial / article , with project sample .

Developing Axis Web services with XML Schemas

enjoy
Yaniv

Wednesday, July 9, 2008

Tuesday, June 24, 2008

Consume Web-Services from C++

gSOAP is a cross-platform development toolkit for C and C++ SOAP XML Web services (SOAP1.1/1.2,WSDL1.1). gSOAP supports XML serialization of native C/C++ data types. Includes SOAP/XML engine, Web server, stub/skeleton compiler, WSDL tools, and much more.

download gSOAP Toolkit latest version OR visit gSOAP page for complete info.

If you will follow the next link you will find a step by step demo to consume j2ee WS, this demo on Windows via VC++ .Use gSOAP to consume J2EE Web services created by WSAD through HTTP and HTTPS