Thread View: borland.public.cppbuilder.internet.web
7 messages
7 total messages
Started by Puri Vidal
Wed, 01 Dec 2004 09:47
Help please!!
Author: Puri Vidal
Date: Wed, 01 Dec 2004 09:47
Date: Wed, 01 Dec 2004 09:47
72 lines
3182 bytes
3182 bytes
I do not know if this is the right place to ask this, buy I need your
help...
I am trying to develop a web service client application using C++ Builder 6.
I have the wsdl file so I try to import it using the WSDL importer, getting
the following:
namespace NS_MyService {
// Warning: Literal parameters of MyService() cannot be unwound
__interface INTERFACE_UUID("{.....}") MyServicePort : public IInvokable
{
public:
virtual void MyService(const ComplexType1 request,
ComplexType2& response) = 0;
};
typedef DelphiInterface<MyServicePort> _di_MyServicePort;
_di_MyServicePort GetMyServicePort(bool useWSDL=false, AnsiString addr="");
}; // NS_MyService
Fist of all, why is the importer not able to import the complex types? To
resolve this I have defined all complex types using classes derived from
TRemotable as follows:
class ComplexType1 : public TRemotable {
private:
AnsiString fField1;
AnsiString fField2;
public:
__published:
__property AnsiString Field1 = { read=fField1, write=fField1 };
__property AnsiString Field2 = { read=fField2, write=fMessageId };
};
In the RegTypes() function I register both types
static void RegTypes()
{
RemTypeRegistry()->RegisterXSClass( __classid(ComplexType1),
WideString( "NS_MyService" ), WideString( "ComplexType1" ) );
RemTypeRegistry()->RegisterXSClass( __classid(ComplexType2),
WideString( "NS_MyService" ), WideString( "ComplexType2" ) );
...
}
And when I finally use the web service, for example, in a button click
event:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
_di_MyServicePort my_service;
HTTPRIO1->QueryInterface( my_service);
if ( my_service)
{
ComplexType1 *request = new ComplexType1();
request->Field1 = "Data1";
request->Field2 = "Data2";
ComplexType2 *response = new ComplexType2();
my_service->MyService( *request, *response ); // Here is
where I get the
.....
delete request;
delete response;
}
}
I get the following compiler error: E2459 VCL style classes must be
constructed using operator new
What am I doing wrong????
Thank you in advance for your help!!!
Puri Vidal
Re: Help please!!
Author: hans galema
Date: Wed, 01 Dec 2004 10:16
Date: Wed, 01 Dec 2004 10:16
23 lines
1854 bytes
1854 bytes
Puri Vidal wrote: > I do not know if this is the right place to ask this, buy I need your > help... As the wsdl newsgroup is dead this maybe is the right place. But it was not the right way how you used the subjec. Do not use it to cry for help but place a relevant subject in it. > _di_MyServicePort my_service; > I get the following compiler error: E2459 VCL style classes must be > constructed using operator new You should have told us what was on line 2459. So where the error occurred. But I think it is on the line that I left. If that is the case you should not instantiate on the stack as you tried but on the heap. Instantiate your service with something like: ptr_di_MyServicePort = new ( my_service ); Hans.
Re: Help please!!
Author: hans galema
Date: Wed, 01 Dec 2004 10:23
Date: Wed, 01 Dec 2004 10:23
15 lines
1265 bytes
1265 bytes
hans galema wrote:
>> _di_MyServicePort my_service;
> ptr_di_MyServicePort = new ( my_service );
Try:
_di_MyServicePort *my_service = new _di_MyServicePort();
or
_di_MyServicePort *my_service = new _di_MyServicePort(this);
Hans.
Re: Help please!!
Author: Puri Vidal
Date: Wed, 01 Dec 2004 10:38
Date: Wed, 01 Dec 2004 10:38
34 lines
1798 bytes
1798 bytes
First of all, thanks for your answer!!! You are right, next time I will try to explain the problem in the subject. The line where I get the error is: my_service->MyService( *request, *response ); That is, where I use the web service, so I think that it is because of the params. But I do not know what is the problem: I create the variables using new, and I pass the content of the pointer as the function asks for params by value... Thanks again!!! Puri Vidal "hans galema" <notused@notused.nl> escribi� en el mensaje news:41ad9ba4@newsgroups.borland.com... > hans galema wrote: > > >> _di_MyServicePort my_servic e; > > > ptr_di_MyServicePort = new ( my_service ); > > Try: > > _di_MyServicePort *my_service = new _di_MyServicePort(); > > or > > _di_MyServicePort *my_service = new _di_MyServicePort(this); > > Hans.
Re: Help please!!
Author: hans galema
Date: Wed, 01 Dec 2004 11:04
Date: Wed, 01 Dec 2004 11:04
19 lines
1859 bytes
1859 bytes
Puri Vidal wrote: > The line where I get the error is: > > my_service->MyService( *request, *response ); Sorry. I now see in your original post that you indicated that line already. My mistake. > That is, where I use the web service, so I think that it is because of the > params. But I do not know what is the problem: I create the variables using > new, and I pass the content of the pointer as the function asks for params > by value... Try: my_service->MyService( request, response ); Hans.
Re: Help please!!
Author: Puri Vidal
Date: Wed, 01 Dec 2004 11:35
Date: Wed, 01 Dec 2004 11:35
63 lines
2874 bytes
2874 bytes
Thanks again!!! As the function is declared virtual void MyService(const ComplexType1 request, ComplexType2& response) = 0; if I use my_service->MyService( request, response ); I get the following errors: Cannot convert 'ComplexType1 *' to 'ComplexType1' Type mismatch in parameter 'request' (wanted 'const ComplexType1', got 'ComplexType1 *') Temporary used for parameter 'response' in call to 'MyServicePort::MyService(const ComplexType1, ComplexType2 &)' Cannot initialize 'ComplexType2 &' with 'ComplexType2 *' Type mismatch in parameter 'response' (wanted 'const ComplexType2 &', got 'ComplexType1 *') And if I try to declare the parameter variables without using pointers: ComplexType1 request; or ComplexType1 request(); or ComplexType1 request = ComplexType(); I get in that line: VCL stype classes must be constructed using operator new. Perhaps the solution is changing the function declaration. The problem is that I think I cannot change it because it was generated by te WSDL Importer... Thanks again for your help. Puri Vidal "hans galema" <notused@notused.nl> escribi� en el mensaje news:41ada558@newsgroups.borland.com... > Puri Vidal wrote: > > > The line where I get the error is: > > > > my_service->MyService( *request, *response ); > > Sorry. I now see in your original post that you indicated that line > already. My mistake. > > > That is, where I use the web service, so I think that it is because of the > > params. But I do not know what is the problem: I create the variables using > > new, and I pass the content of the pointer as the function asks for params > > by value... > > Try: > > my_service->MyService( request, response ); > > Hans.
Re: Help please!!
Author: Saulo I. Regis
Date: Wed, 01 Dec 2004 13:39
Date: Wed, 01 Dec 2004 13:39
7 lines
1397 bytes
1397 bytes
> my_service->MyService( request, response ); and what about ? my_service->MyService( &request, &response ); Saulo
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads