Hosting webservices on Windows Embedded Compact (Windows CE) using gSOAP

In this blog post I'd like to discuss how to host webservices on a Windows Embedded Compact device. You can certainly consume webservices on a smart device using managed code, but hosting a webservice on the device is unfortunately not possible using managed code. So it's back to good old native code again!

I will use gSOAP, a third party framework, that will do most of the nitty gritty work for us. Sounds easy right? Let's get started!

The most important part is the WSDL (Web Services Description Language) file. The WSDL file is an XML document that describes the interface and thus which methods we want to expose and host on our device. I won't spend much time explaining the WSDL syntax as there are lots of online WSDL tutorials available that explain the syntax much better than I ever could.

For now I just created a very simple WSDL file that describes one very simple webservice method: string HelloWorld(string name)

The wsdl:

<?xml version="1.0" encoding="utf-8"?>
<definitions name="HelloService"
   targetNamespace="http://www.YourServer.com/wsdl/HelloService.wsdl"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns="http://www.YourServer.com/wsdl/HelloService.wsdl"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <message name="HelloWorldRequest">
    <part name="name" type="xsd:string"/>
  </message>
  <message name="HelloWorldResponse">
    <part name="answer" type="xsd:string"/>
  </message>

  <portType name="HelloWorld_PortType">
    <operation name="HelloWorldOperation">
      <input message="tns:HelloWorldRequest"/>
      <output message="tns:HelloWorldResponse"/>
    </operation>
  </portType>

  <binding name="HelloWorld_Binding" type="tns:HelloWorld_PortType">
    <soap:binding style="rpc"
       transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="HelloWorldOperation">
      <soap:operation soapAction="HelloWorldAction"/>
      <input>
        <soap:body
           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
           namespace="urn:examples:helloservice"
           use="encoded"/>
      </input>
      <output>
        <soap:body
           encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
           namespace="urn:examples:helloservice"
           use="encoded"/>
      </output>
    </operation>
  </binding>

  <service name="HelloWorld_Service">
    <documentation>WSDL File for HelloService</documentation>
    <port binding="tns:HelloWorld_Binding" name="HelloWorld_Port">
      <soap:address
         location="http://Topaz:8080"/>
    </port>
  </service>
</definitions>

As you can see there are 6 main tags in the WSDL within the mandatory <definition></definition> tags:

types
Provides data type(s) used for the method parameters and return values.
message
Represents an abstract definition of the data being transmitted. A message consists of logical parts, each of which is associated with a definition within some type system.
portType
A set of abstract operations. Each operation refers to an input message and output messages.
binding
Specifies concrete protocol and data format specifications for the operations and messages defined by a particular portType.
port
Specifies an address for a binding, thus defining a single communication endpoint.
service
Used to aggregate a set of related ports and to set the network location of the actual service.

Basically Type, Message and portType describe the webservice methods used and binding, port and service describe how to transfer the data over the socket.

The location contains the IP address or hostname of the target that runs the server hosting the webservice. In this example I use a Topaz device (you would normally set this to the IP address or hostname assigned to your device).

After this very brief WSDL description let's set up our Visual Studio 2008 project. This will be the biggest task.

Before we can create the actual VS2008 project we need to perform a couple of steps (described in more detail below):

  1. Import the WSDL in an emtpy project
  2. Let gSOAP generate a header file via wsdl2header.exe
  3. Let gSOAP generate the corresponding implementation *.cpp file
  4. Implement our methods

Because gSOAP generates a lot files I prefer to separate the generated files from the actual implementation files so that you only have to focus on your implementation and not what is being generated by gSOAP. So let’s begin and create an empty project in Visual Studio 2008 and add the WSDL file.

Step 1: Import the WSDL in an empty project

Open Visual Studio and create a new C++ smart device project (File menu | New | Project) and enter HelloWorldWebService as the name of the solution.

Select Ok, and click next on the "Welcome to the Win32 Smart Device Project Wizard" dialog. In the "platforms" dialog select the SDK for your target device. As you can see I chose the Topaz device (http://guruce.com/topaz). Select next:

In the "project setttings" dialog select "console application" and "empty project" and click finish.

When the solution is created, go to the solution explorer (normally this would be visible by default but if not: go to View | Solution Explorer) and add a new filter "gsoap" in the "header" section (right click "Header Files", choose Add->New Filter) and do the same in the "source" section. We'll get gSOAP to generate its files there. Now create a new file with extension .wsdl in your solution's folder. Copy the contents of the sample WSDL above and add the WSDL file to your solution (right click on the solution and select “add existing item”). I've named the file HelloWsdl.wsdl. It should look something like this:

Step 2: Let gSOAP generate the header file from our wsdl.

First download gSOAP in order to get the tools needed. You can download gSOAP from this location:
http://sourceforge.net/projects/gsoap2/files/
Make sure you save the extracted files in an appropriate folder for you to remember because we need references to this folder within our visual studio project later on.

Now go back to your solution and right click on the wsdl file and select properties. In the “Custom build step“ add the following command (note that I’ve put the gSOAP tools in the $(SolutionDir); make sure you get the path right and that the solution directory doesn't contain any spaces) in the “Command Line” section:
$(SolutionDir)\gsoap-2.8\gsoap\bin\win32\wsdl2h.exe -s $(InputPath) -o $(ProjectDir)$(InputName).h
This will run the wsdl2h.exe to generate our header file. The parameters specify the input and output file. In the “Outputs” field on the property page enter:
$(InputName).h

.

You need to specify something in the “outputs” field in order to make the wsld ‘compilable’. Note that the path here contains a version number (gsoap-2.8). This can change of course so keep that in mind. Also notice that I did this "setting" for "All Configurations" and not just for the current one.

Click “Apply” and “Ok”, and then right click the wsdl file again and choose “Compile”.
Now our header (HelloWsdl.h) file is generated in the project directory and we need to add this file to the project. In the solution explorer right click on the “gsoap” folder in the header section and choose “add existing item”. Navigate to HelloWsdl.h and add it.

Let’s do the same for generating the cpp file:

Step 2: Let gSOAP generate the cpp source file.

In the solution explorer right click on the HelloWsdl.h, which we just added in the previous step, and select “properties”. In the “Custom build step“ add the following command:
$(SolutionDir)\gsoap-2.8\gsoap\bin\win32\soapcpp2.exe -S $(InputPath)

In the “Outputs” field enter the following:
$(InputName).cpp

.

Right click on the HelloWsdl.h file and choose "compile". This will generate a bunch of files as well, but we are not yet ready to build our solution... If you would try to build the solution at this time, like I did when I first started with gSOAP, you will run into a lot of compile errors so bear with me for a few more steps.

Right click the gSOAP folder in the header section in your solution and add these header files:
- soapH.h
- soapStub.h

Right click the gSOAP folder in the source section in your solution and add these cpp files:
- soapC.cpp
- soapServer.cpp

The next step is to add stdsoap2.h and stdsoap2.cpp to your solution. You can find these 2 files in “gsoap-2.8\gsoap”. Add them together by right clicking the project in the solution explorer and select “Add existing item”. They will automatically appear under the correct “header” and “source” sections.

We’ve added the stdsoap2.h to our solution but we also need to add the directory where stdsoap2.h resides to the project's "include directory list". Add “$(SolutionDir)\gsoap-2.8\gsoap” to the include directorie list by right clicking the project in the solution explorer and click "Properties". In the “Configuration Properties" | C/C++ | General” section you will find “Additional Include Directories”.

Now that we’re done generating files we can actually start to code!

Step 4: Implement our methods

First we need to create the cpp source code containing the main definition and our methods. I will use 2 separate files for this. The first file will contain the server code and will listen to incoming requests/messages. The second file will actually implement our webservice's methods.

Right click on the “Source Files” in the Solution Explorer and select “New Item”. Choose C/C++ file and name the file HelloWsdl.cpp. Do exactly the same for a file called HelloWsdlMethods.cpp.

Your complete solution should now look like this:

.

Let’s start with an easy one; open the HelloWsdlMethods.cpp and copy and paste the following code snippet into that file:

#include "soapH.h"

int ns1__HelloWorldOperation(struct soap*,
                             char*  name,       /// Request parameter
                             char*  &answer     /// Response parameter
)
{
    printf("Hello my method\r\n");

    char* myName = {"Erwin"};
    answer = myName;
    return SOAP_OK;
}

Now if you have built the project prior to adding this piece of incredible intelligent code, you would have seen an unresolved external in the error list: this method. The above function is generated (or better; declared) by gSOAP and the code snippet above is the implementation. You can find the declaration of this method in the generated soapStub.h file:

/************************************************************************\
* Server-Side Operations                                                    
\************************************************************************/

SOAP_FMAC5 int SOAP_FMAC6 ns1__HelloWorld(struct soap*, char *name, char *&answer);

This is where you will find your method's declarations when you have added your own in the WSDL.

We’re almost there! The last thing we need to do is add our server code. Code that will wait for a request from any client. Below is the code needed. It may look complicated at first but don’t let it scare you. This code is taken from the gSOAP website (section 7.2.3 How to Create a Stand-Alone Server in the documentation section: link listed below) with some minor changes that I will describe below:

/** Include the namespaces struct */
#include "HelloWorld_USCOREBinding.nsmap"

int _tmain(int argc, char* argv[])
{
   struct soap soap;
   int m, s; // master and slave sockets
   soap_init(&soap);
   soap_set_namespaces(&soap, namespaces);      //** Set the namespaces **/
   m = soap_bind(&soap, "", 8080, 100);         //** leave the string empty and gSOAP will figure out what our "localhost" is **/
   if (m < 0)
      soap_print_fault(&soap, stderr);
   else
   {
      fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
      for (int i = 1; ; i++)
      {
         s = soap_accept(&soap);
         if (s < 0)
          {
            soap_print_fault(&soap, stderr);
            break;
         }
      fprintf(stderr, "%d: accepted connection from IP=%d.%d.%d.%d socket=%d", i,
            (soap.ip >> 24)&0xFF, (soap.ip >> 16)&0xFF, (soap.ip >> 8)&0xFF, soap.ip&0xFF, s);
      if (soap_serve(&soap) != SOAP_OK) // process RPC request
      soap_print_fault(&soap, stderr); // print error
      fprintf(stderr, "request served\n");
      soap_destroy(&soap);      // clean up class instances
      soap_end(&soap)// clean up everything and close socket
      }
   }
   soap_done(&soap); // close master socket and detach context

   return 0;
}

Copy and paste the code above into HelloWsld.cpp.

I've listed my changes with some comments (/** */). What is added is that we include a namespaces struct to explicitly set the correct namespaces. gSOAP (soapcpp2.exe) will not only generate code files but also a *.nsmap file which generates a static struct containing the correct namespace to use. The soap_set_namespaces() method will set this struct to use it. That’s it!

All of this may seem like a lot of work but when you are finished setting up the project every change you make in your interface (wsdl) will automatically drill down into your implementation. After setting up the project you most likely will only need to work on the wsdl file and HelloWsdlMethods.cpp to add your own methods.

Now that we've created the server on Windows CE it is time to create a client that will consume our service:

The C# Managed Client

Create a C# .NET (desktop) application with just one Form (I'm not going through each single step of how to create a C# .NET application as this is outside of the scope of this article and assumed known). Add just one button to the form and give it a name. After that we need add our webservice reference to the solution (our wsdl file). In the solution explorer right click on "References" and select "Add Service Reference". In the address field enter the path and the name of the wsdl file on your local machine. In my case this is: C:\Data\Development\HelloWorldWebService\HelloWorldWebService\HelloWsdl.wsdl. I named the reference HelloWsdlMethods and this name will appear in the solution explorer. Click "Go":

.

On the main form Double click on the button and paste the following code into the button handler:

private void btnTest_Click(object sender, EventArgs e)
{
    try
    {
        HelloWsdlMethods.HelloWorld_PortTypeClient server = new HelloWsdlMethods.HelloWorld_PortTypeClient();
        string name = server.HelloWorldOperation("Dummy");
        MessageBox.Show(name);
    }
    catch (Exception error)
    {
        MessageBox.Show("Request failed: " + error.Message);
    }
}

The code behind the button will access our server and call the webservices method. As you can see the naming is probably not the best but for this example it will do.
Run the server program (HelloWorldWebService.exe) on the target and run the client on the desktop. If you've done everything correct you should see the following after pressing the "Test" button:
The C# Client running on the desktop:

Application console on the Windows Embedded Compact device:

Things to lookout for

As you have seen there is a bit of work involved to get gSOAP to integrate nicely with Visual Studio 2008. The process is error prone and gSOAP's logging doesn't help much in most cases. In my experience there are basically three areas where things are most likely to go wrong:

  • Location
  • This tag in the wsdl file specifies the network address on which the webservices are running. Make sure it is set right.

  • Namespaces
  • Make sure that the namespaces used in the wsdl file match the ones in the source code (use the nsmap file) and don't forget to call soap_set_namespaces().

  • Hostname
  • Make sure that you leave the hostname empty: soap_bind(&soap, "", 8080, 100). Specifying the hostname does not work on CE. Also the tools wsdl2h.exe and soapcpp2.exe have a lot of options that I did not discuss in this article. However, getting to know the different gSOAP options is definitely worth the time. The gSOAP website contains a wealth of information and the documentation is comprehensive.

Of course this article only shows a very simple example of how to use Webservices on Windows CE with gSOAP but it should be enough to get you going on much more complex webservices hosted on smart devices.

Please let us know if you'd like to see a more complex example (for instance transferring a file through webservices).

Good luck!

AttachmentSize
File gSoap_WebService_Sample.7z32.66 KB

Comments

You forgot to say DON'T create solution in folder which contains spaces because compiling in 2nd step will fail :)
for example "C:\My projects\HelloWorldWebService"

great post!

Thanks, I've modified it...

Tnak to you :)

Can you please tell me is it possible to publish gSoap services on eBox and Windows Embedded Compact 7 OS?

I got errors Errors:
1 error LNK2019: unresolved external symbol "public: virtual __thiscall soap::~soap(void)" (??1soap@@UAE@XZ) referenced in function _wmain HelloWsdl.obj
Error 2 error LNK2019: unresolved external symbol "public: __thiscall soap::soap(void)" (??0soap@@QAE@XZ) referenced in function _wmain HelloWsdl.obj
Error 3 fatal error LNK1120: 2 unresolved externals SDK Vege Tech

does it need to include some specific features in OS design?

,thanks forward.

Hi arso,

I havn't tried it yet on Compact 7, but I don't forsee any issues with it though. Perhaps if you can send me your application I can take a look.

I will create and test the gSoap solution on a Compact 7 system shortly and let you knwo if I have any issues with it...

I try your example and it's work but image if I have an other class ServerCore for example that contains the business Server or Logic Core that I need to implement my HelloWord Service. How to do because this method is static.
Thank you for our Help

Create a proxy class and forward your webservices request to this proxy. This proxy can either handle your business logic or forward it to your business logic class(es).

Let me know if you succeed or not. If not I will try to create a sample for this...

Hi,

I have created and build a Test image with Embedded Compact 7 (VPC:x86) and it's corresponding SDK. I installed the SDK and added the SDK to the HelloWorldWebservices solution. The solution builds and runs fine. I can send you sysgensettings.out to you? In that file are all sysgen variables listed which are configured for that image. This way you can compare that with your image...

Hope it helps,

Erwin

Hi,

I created Gsoap web service using VPC86 SDK and tried porting on the same, but it is unable to bind with the server and simply exit out of main function.

Could you please help me out , do i need to change anything apart from the tutorial mentioned in this link.

I need it badly kindly help

Thanks
Om

Hi,

Did you followed the tutorial and copy paste the main routine (HelloWsdl.cpp)? The only changes I made where in this routine. Do you have network connectivity? Can you try a simple socket application? What does the error log say?

Hi Erwin,

Thanks a lot for the quick response.
Yes i have network connectivity,and i am using virtual PC 86(WINCE7 OS Design) to port the application.

while building the VPC 86 for WINCE 7 I have also included GSOAP server and client SYSGEN from catalog items.

still it is unable to connect to the service when i run the gsoap client mentioned in this link, it throws error as "unable to connect".

DO i need to include any other SYSGEN for VPC 86 to port GSOAP server?

when i debug the Helloworldwebservice i see that value of 'm' while Soap_bind is -1 so simply it comes out from the main in HelloWsdl.cpp.

could you please send me the steps you followed to make it work on VPC 86 for WINCE 7 as u mentioned in the earlier post.

Thanks

Om

Hi Om,

It's actually no different then the steps followed in the original post.
Does the logging of the OS (serial or platform builder output) give you any clues? It could be that the port is already in use or that the winsock is misssing in your OSDesign.
send me your sysgensettings.out, perhaps there are components missing in the OS?

good luck,

Hi Erwin,

Many many thanks for the reply to my post.
I could solve the issue by changing the port no. i.e. from 8080 to 1083 or some other values now the master socket is getting created.
but still i am unable to connect to the service while using GsoapClient sample given by you.

it throws error as unable to connect.

i followed the steps mentioned by you i.e. first run Gsoap exe on client side then run the client but after clicking on test button first it tries to connect and later says unable to connect no service found.

Any idea would be welcome and helpful for me.

Hi,

Did you check the paragraph "Things to lookout for" ?
for example "Location" in the wsdl is very important to get that right. In the sample it is:

<service name="HelloWorld_Service">
  <documentation>WSDL File for HelloService</documentation>
  <port binding="tns:HelloWorld_Binding" name="HelloWorld_Port">
    <soap:address
      location="http://Topaz:8080"/>
  </port>
</service>

Where "Topaz" is the device name. Change your CE image with the Topaz host name, or even more easy change the wsdl file according to your device name.
Make sure you rebuild the server and the client code.

If it is not working, send me your solution (preferable zipped) to "my firstname" at guruce dot com

Good luck
erwin

Hi Erwin,

I changed the port address from 8080 to 1008 and i am able to port.
also i had given the location name as http://device ip address:1008(port no.)
Initially i was trying without port no. and only with ip address so it was not connecting.

Now i just wanted one WSDL file which is having more than one operation and get connected successfully.
i tried creating on my own but it is not connecting to web service.

if possible kindly post a new wsdl sample file.

Hi Erwin,

Thanks for help and your post.
i have encountered a new problem now.
i was trying to access the service from silverLight Application but i am getting cross domain error.

Its getting connected to the device but while responding it is not returning any value and giving "cross domain access error".

Do i need to modify wsdl file.

Kindly help

Thanks

Hi Erwin,

I get the following error once i click on test buttonin gsoap client application.
"Request Failed: there was no endpoint listening at http://Topaz:8080/ That could accept message."

As i mentioned in the prevoous post that i am using VPC 86 OS design for WINCE7.

Kindly help

Hi,

I'm starting to use gsoap and it generates undefined SOAP_FMAC4 and SOAP_FMAC6. Do you know what to do with it?

Regards,

Francois

Doesn't ring a bell. What platform are u running and did you complete all of the steps listed?

Erwin

I built my WSDL with XMLSpy. My operating system is Windows XP.

Thanks,

Francois

Is there somebody who have an idea what is the problem of the undefined SOAP_FMAC6 and others???

Thanks for this Post.While creating project i used Visual Studio 2005 and selected Pocket PC 2003 SDK.And i changed location as :

I'm getting the following error :

1>------ Build started: Project: HelloWorldWebService1, Configuration: Debug Pocket PC 2003 (ARMV4) ------
1>Compiling...
1>HelloWsdl.cpp
1>Linking...
1>stdsoap2.obj : error LNK2019: unresolved external symbol __security_cookie referenced in function soap_flush_raw
1>HelloWsdl.obj : error LNK2001: unresolved external symbol __security_cookie
1>stdsoap2.obj : error LNK2019: unresolved external symbol __security_check_cookie referenced in function soap_flush_raw
1>HelloWsdl.obj : error LNK2001: unresolved external symbol __security_check_cookie
1>LIBCMTD.lib(gshandler.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>Pocket PC 2003 (ARMV4)\Debug/HelloWorldWebService1.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://d:\TestCode\HelloWorldWebService1\HelloWorldWebService1\Pocket PC 2003 (ARMV4)\Debug\BuildLog.htm"
1>HelloWorldWebService1 - 6 error(s), 0 warning(s)

Pl. help.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Did you complete all of the steps?
What version of gSoap do you use? I have tested it with 2.8.0 and the latest 2.8.1 and that works. I don't see the __security_cookie used in that particular method (soap_flush_raw).
soap_flush_raw is implemented in stdsoap2.c. Could you verify that?

Erwin

Hi,
Thanks for the reply.
I'm using Gshop2.8.Now the problem got resolved.I used WinCE 5.0 SDK instade of Pocket PC 2003 SDK.Now i'm not getting any error while build.But there is a Deployment error.I'm not able to run this on my Windows Vista.Let me tell it more clearly:-

1.If i'm running directly from Visual Studio 2005(by clicking on Run Button)its saying there is a deployment error.
2.If i'm going to my debug folder and derectly running the application its saying "this is not a valid Win32 application".

So, here the question is Can i use the Wince 5.0 ARM emulator to run it.If,Yes, Then How?
Pl. suggest.

Can I make it secure by applying SSL certificates? and How?

Yes, you can. It is however outside of the scope of this blog post and too much to explain in a comment reply. Please contact us through the contact page if you need further support with this.

Hello,
i followed the step u mentioned, but can you explain where SolutionDir will be ? and how ypu place the gsoap tool in that.I have downloaded the gsoap tool and given the path of that , while compiling m getting error saying
error PRJ0019: A tool returned an error code from "Performing Custom Build Step"

Then i used the same command what ever you mentioned,then also i am getting same error, can you tell me how to solve i am using latest version 2.8.5 of gsoap

Hi,

The solutiondir is the directory where your solution (*.sln file) is located. To discover your solution directory, right click on the wsdl file and select properties. In the “Custom build step“ click, for example, in the "Command Line" field and select the 'browse' option appearing at the end of the text box (...). There you find (in the pop-up) the 'macro's' button. Click on the 'macro's' button and there you can see the, as one of many, SolutionDir macro and its corresponding path.

In the example given in the blog, the gsoap binaries are located in the solution dir, something like:

HelloWorldWebService.sln

Follow the steps mentioned carefully and you should be fine. Its all about getting the paths to the tools correctly (soapcpp2.exe and wsdl2h.exe).

Let me know if you still encounter any problems.

that problem is solved, while building m getting this error Error error LNK2019: unresolved external symbol wmain referenced in function "void __cdecl mainCRTStartupHelper(struct HINSTANCE__ *,unsigned short const *)" (?mainCRTStartupHelper@@YAXPAUHINSTANCE__@@PBG@Z) corelibc.lib ,

do you have any idea why its coming ?

Hi,

In the last part of creating the server side code (just before The C# Managed Client) the main function is listed. you should create HelloWsdl.cpp. There you should define the main function.
The unresolved error is the result of not having the main. Create the HelloWsld.cpp file and copy/paste the content of where int _tmain(int argc, char* argv[]) is listed. Then you should be fine.

I try to follow your steps discribed, but the problem is that I'm not able to generate the files from the input.h file when executing
gsoap-2.8\gsoap\bin\win32\soapcpp2.exe -S
The problem is that it builds but there are no new files?

Can you help me

Can I make it secure by applying SSL certificates and how?
Thanks.

Thank you so very much for your example. I would very much love to see a more complicated example. The first one was great!! We would like to pass a complex type of an xml string, and a numeric type that indicates what the XML string is. Also, passing a file is an interesting idea. Would love to see that as well.

Thanks Erwin!

Hi,

thanks for your reply.

I am working on a sample to upload a file.

i am to run the service in wince enviroment and when i send the request from silverlight client ,the message in console displays like "accepted the request from "client machine ip", but i am not able to get the result, i am getting cross domain error.After doin google ,i found that cause of some security concern we need to add clientaccesspolicy.xml where web service is hosted.Can u guide ,how to achieve this.Please help.trying this from last 2 days not able to figure it out.

I can create/generate the .h File form the WSDL but when i try to create/generate the .cpp File I get the following error

Error 1 error PRJ0019: A tool returned an error code from "Performing Custom Build Step" ChargePointServer ChargePointServer

Why do I get this error??
I use the correct "solutionDir" because otherwise I won't be able to create/generate the .h File.

Any ideas/help ??

hmmm not sure what this error means. Try to run the soapcpp2.exe manually in a command prompt to see what is going on ($(SolutionDir)\gsoap-2.8\gsoap\bin\win32\soapcpp2.exe -S $(InputPath)) probably it will give you some more info about what happend.

second: I just did a retest of this blog with the latest version of gsoap and WEC7 virutal pc SDK but the steps are still valid. Make sure you follow each step carefully.
third: what is your environment? WEC7 wince6/5...

lastly if you still encounter issues pass me your solution an I can take a quick peek what's going wrong...

I believe I had this same issue. I noticed after looking at the build log that $(SolutionDir) adds a backslash, so the command line is not properly linking to the correct file path. So instead, do $(SolutionDir)gsoap-2.8\gsoap\bin\win32\soapcpp2.exe -S $(InputPath)

Remove the extra "\"

thank you for this example

are there any examples for consuming this service with a javascript client

I haven't tried it so I don't know actually, sorry

Hello
thanks for this great post
although you explained it very well, I have a little problem

WebService is running and the c# managed client is working also
consuming the webservice with SoapUI is also working without any problems

my goal is to call the webservice from my website (that is on the same ce device as the service) via javascript
but I get errro 405 "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://x.x.x.x' is therefore not allowed access."

Do you have any suggestions how to resolve this? I found some hints, but none of them is for a webservice hosted on Win CE.

thanks

Thanks! actually I don't know about the error and I need to replay the scenario. as an alternative you might get away with inter communications like messageueue's. I will take a look at and get back to you.

is there any way to set/add response header (Access-Control-Allow-Origin - set it to "*" or whatever else)?

thank you very much

probably cause you have access to the feedback etc, but (as in the other post) I need to replay your scenario and dig into this a little more

Hi, was just reading your blog and was wondering if there is a way to consume a WCF service in a Platform Builder project for WEC2013. Haven't really found any examples of how to do this online for WEC2013,

Thanks,

Nick

Hi Nick,

Consuming WCF services in .NET CF is easy and pretty much the same as on big Windows .NET. There are some things you need to do a little bit different in .NET CF, but they are easy. Do you have any specific problems? Have you tried consuming any WCF service on CE? We have written lots of code consuming WCF services on CE and have found no blocking issues with it. Hosting services (what the above article is about) is another matter completely, but with the above description it should be no problem anymore either.

Thanks for the reply Michel. Think I am just having problems understanding what to do to be honest. I am ok with WCF and my Services run fine as I have a prototype done with a WPF UI. With this Platform Builder project though, because it is in c++ you cant add a reference to the WCF Service, and I haven't really used c++ before so I dont know how to link my c++ Subproject and my c# WCF projects which are in the same solution.

I just want to be able to call my Operation Contracts in my c++ project which is the UI,

Thanks,

Nick

Why do you need to have this as a platform builder subproject? It's possible, but most probably more hassle than it's worth... Why don't you just keep it as a VS project and just include the binaries as a PB subproject? It's also possible to build the VS project via a command in prelink.bat and copy the resulting exe's. Much easier than trying to build it as a true PB subproject....

I am making a Handheld product so I am using Windows Embedded Compact 2013 to build the User Interface, which I can program by creating a subproject using the XAML for Windows Embedded tools. That UI is designed in Expression Blend before hand. Then I have WCF projects which have Operation Contracts that query the data from a Dynamics NAV database.

So far the only thing holding me back is calling my Operation Contracts in the User Interface.

I've been learning as I go on so not sure if I am doing this the right way,

Nick

Hi I have windows embedded compact 2013 powered device, want to know if you were able to host web services on that.

Thanks in advance
vikram gupta

Pages