Search This Blog

Thursday, April 4, 2013

ASP.NEW web service creation - top down

sometime you want to create a mockup web service based on wsdl files that you get from the client.
the client sent to you the wsdl file , because he not allowed to access to his domain while developing the solution.

the easy way to create such service is with in your domain for testing.
you can do so via wsdl.exe program that ship with MS VS2008/2012 (Visual Studio 2008 Command Prompt).

if you have external xsd file that linked from the wsdl , add it to the command after the wsdl file.

e.g.
wsdl.exe my_demo.wsdl my_demo.xsd /l:CS /serverInterface /out:D:\MyStuff\ServerGenCode

the above command generates the interface file is D:\MyStuff\ServerGenCode directory based on the wsdl file and the xsd.

after generating the interface file , you need to implement the interface
e.g.
public class WebTestService : System.Web.Services.WebService, IMyDemo
{

    #region IMyDemo Members
    [WebMethod]
    public string GetName()
    {
     return "It Works !!!!";
    }
    #endregion 
}

enjoy
Yaniv Tzanany

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

Wednesday, March 6, 2013

Usefull MQ command

here are some usefull comand to use when working with MQ
command to display the queuestatus of a queue:
dis qs() type(handle) all 

command to display the queuestatus of a queue (and only display the pid) :
dis qs() type(handle) pid 

command to display the queuestatus of a queue (and display the applicationtag and the pid) :
dis qs() type(handle) appltag pid
display all the queues that contains more then 0 messages: dis ql(*) where (curdepth gt 0) 

start an api trace:
strmqtrc -m [QM]  -t api
(the -t has several options. Logs are written to: /trace)

end a trace:
endmqtrc -m [QM]


on windows you can read the TRC files via text viewer.

Enjoy 
Yaniv Tzanany