Instantiate Soap Into Class

6 posts / 0 new
Last post
Erwin Nandpersad
ermisnomore's picture
Offline
Mobile Conjurer
Joined: 16 Jan 2012
Posts:
Instantiate Soap Into Class

Hi, All
I am trying to establish a Soap Connection into a nativeUI project and show the data. However when i put the Soap.h and the Soap.cpp into my project folder and call the Class it's not working.

In the Soap.cpp the following line is outlined:
mContext.init(this, this);

When i run the program the compiler outputs the following.

/Users/erwin/workspace/test123/Soap.cpp:145: Error: Unresolved symbol '__ZN3Mtx7Context4initEPNS_11MtxListenerEPNS_11XmlListenerE',
/Users/erwin/workspace/test123/Soap.cpp:162: Error: Unresolved symbol '__ZN3Mtx7Context11feedProcessEPc',
/Users/erwin/workspace/test123/Soap.cpp:233: Error: Unresolved symbol '__ZN3Mtx11XmlListener19mtxUnicodeCharacterEi',

Anyone knows whats happening?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi, you need to add Mtx.lib to your project dependencies. Add it to the list of libs in 'Additional Libraries'

Build SettingsBuild Settings

Erwin Nandpersad
ermisnomore's picture
Offline
Mobile Conjurer
Joined: 16 Jan 2012
Posts:

Hi Sam, Thanks.
Do you also know how to implement the "Soap Example" into my project?
For now i have the following situation.
I put the files soap.h and soap.cpp into my project folder.
Then i have a class called Class_A, there i implement the SoapListener and add the abstract methodes.
From there i can add the data fetched from soap into a Label or a EditBox.
Is this the correct way?

Erwin Nandpersad
ermisnomore's picture
Offline
Mobile Conjurer
Joined: 16 Jan 2012
Posts:

HI (sorry to post so many times), I want to add the value of a Soap Request into a Label (nativeUI). But i cant get it to work. I am using the Soap.cpp from the example folders. I did the following, i created a class called Stats.cpp and tried to inherit the example Soap File.
This looks like this. (I removed the Widgets to specify the issue better)

#include "Stats.h"
// constructor
static const char sUrl[] = "http://wsdlurl";
	const char sData[] ="<aff:getFeeds soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
	         "<affiliateSiteID xsi:type=\"xsd:nonNegativeInteger\">xx</affiliateSiteID>"
	         "<options xsi:type=\"aff:FeedFilter\">"
	            "<ID xsi:type=\"xsd:nonNegativeInteger\">?</ID>"
	            "<campaignID xsi:type=\"xsd:nonNegativeInteger\">?</campaignID>"
	            "<campaignCategoryID xsi:type=\"xsd:nonNegativeInteger\">?</campaignCategoryID>"
	           " <assignmentStatus xsi:type=\"aff:CampaignAssignmentStatus\">?</assignmentStatus>"
			"</options>"
	      "</aff:getFeeds>";

Stats::Stats():
Screen()

	{




			SoapRequest mSoap;
			mSoap.start(sUrl, sData, sizeof(sData) - 1, this);

	}

Stats::~Stats()
	{



	}





void Stats::soapError(int code) {
		//printf("soapError(%i)\n", code);
		// an error code -6 (CONNERR_CLOSED) is normal after soapEnd(),
		// as the server closes the HTTP connection.
	}
	void Stats::soapEnd() {
		//printf("soapEnd()\n");
	}

	void Stats::mtxEncoding(const char* name) {
		//printf("encoding '%s'\n", name);
	}
	void Stats::mtxTagStart(const char* name, int len) {
		//printf("starwt '%s'\n", name);
	}
	void Stats::mtxTagAttr(const char* attrName, const char* attrValue) {
		//printf("attr %s='%s'\n", attrName, attrValue);
	}
	void Stats::mtxTagStartEnd() {
		//printf("startEnd\n");
	}
	void Stats::mtxTagData(const char* data, int len) {
		//printf("data '%s'\n", data);
	}
	void Stats::mtxTagEnd(const char* name, int len) {
		//printf("end '%s'\n", name);
	}
	void Stats::mtxParseError(int offset) {
		//printf("parseError %i\n", offset);
	}
	void Stats::mtxEmptyTagEnd() {
		//printf("emptyTagEnd\n");
	}

	unsigned char Stats::mtxUnicodeCharacter(int unicode) {
			char c = XmlListener::mtxUnicodeCharacter(unicode);
			if(c == 0) {	//we don't know how to convert this character
				c = '?';
				//lprintfln("Unknown unicode character: 0x%x", unicode);

			}
			return c;
		}

I created the header file like this.

#ifndef Stats_H_
#define Stats_H_
#include <maapi.h>
#include <NativeUI/Widgets.h>
#include "Soap.h"
#include <conprint.h>
#include <mavsprintf.h>
using namespace NativeUI;


class Stats: public Screen,
				public SoapListener

	{

public:
		// constructor
		Stats();
		// destructor
		~Stats();


void createUI();
virtual void soapEnd();
virtual void soapError(int code);
virtual void mtxDataRemains(const char* data, int len);
virtual void mtxEncoding(const char* name);
virtual void mtxTagStart(const char* name, int len);
virtual void mtxTagAttr(const char* attrName, const char* attrValue);
virtual void mtxTagStartEnd();
virtual void mtxTagData(const char* data, int len);
virtual void mtxTagEnd(const char* name, int len);
virtual void mtxParseError(int offset);
virtual void mtxEmptyTagEnd();
virtual unsigned char mtxUnicodeCharacter(int unicode);
virtual void connWriteFinished(Connection* conn, int result);
virtual void connRecvFinished(Connection* conn, int result);
virtual void httpFinished(HttpConnection* http, int result);


	};

#endif

When i run the code it give error's:
Error: Unresolved symbol '___cxa_pure_virtual', .
How can i get the Soap request working? The Soap.cpp and Soap.h is exactly the same as provided in the example folder. I am stick on this problem for a while. I hope someone can push me in the right direction!!

Many many thanks for the help provided!

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

OK. I need to the the whole project to fix this properly. Can you zip it up, without the FinalOutput and Output folders?

Have you seen this blog post? It doesn't address your issue directly, but it does help generally with SOAP.http://www.mosync.com/blog/2012/01/debugging-soap-mosunc

Finally, you can always use AppMancer ;-) It has a SOAP library which you can use programatically, you don't need to build up your own SOAP strings, nor do you need to parse XML. It will return you a DOM object (XmlNode), and you can use XmlDataBinder (version 3) or XMLRepeater (version 2.7) to bind the XML directly to UI.

Erwin Nandpersad
ermisnomore's picture
Offline
Mobile Conjurer
Joined: 16 Jan 2012
Posts:

Hi Sam,
Thanks for your good support! Ill send you the code tomorow.
Many thanks (i'm also gonna look at your framework appmancer).