You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Oliver Lyttleton <ly...@cs.tcd.ie> on 2004/06/21 11:57:11 UTC

Axis C++ Calculator example

I'm not sure how I get the Axis C++ Calculator example to work. I know
that the files generated by WSDL2ws are skeletons, and must be completed
by the user, but I don't know what else needs to be added!

For instance, do I need to add anything to
$AXISCPP_HOME/samples/client/simple/calculator.cpp
in order to get the example to work?

Do I need to add anything to
$AXISCPP_HOME/samples/server/simple/calculator.cpp?

My question is: what files do I need to add extra code to in order to
get the calculator sample to work? And what code should I add?

Thanks in advance,

Oliver


Re: Axis C++ Calculator example

Posted by Mansart Jean-sebastien <je...@etu.univ-savoie.fr>.
Have you deploy your webservice ???
check-it here: http://localhost/axis
there should be a list of webservices deployed...

Oliver Lyttleton wrote:

>Sorry, that still doesn't work! Any other suggestions from anybody?!?
>
>On Mon, 2004-06-21 at 15:12, Mansart Jean-sebastien wrote:
>  
>
>>Oliver Lyttleton wrote:
>>
>>    
>>
>>>On the client side, I'm doing exactly as you're telling me. However, I
>>>am unsure as to what should be done on the server side. Also, I'm a
>>>little confused by the Calculator.cpp file on the client side....
>>>
>>>if (AXIS_SUCCESS == m_pCall->Invoke())
>>>	{
>>>		if(AXIS_SUCCESS == m_pCall->CheckMessage("subResponse",
>>>		"http://localhost/axis/Calculator"))
>>>		{
>>>			/*not successful*/
>>>		}
>>>	}
>>>
>>>Does this mean that if the second if statement evaluates to true, the
>>>invocation has failed? How is the value for the result of an operation
>>>sent back to the client, should code be inserted to do this where the
>>>"not successful" comment is? If so, what methods from Call.cpp are used
>>>to do this?
>>> 
>>>
>>>      
>>>
>>Yes I know that this part is a little disturbing...
>>So, for myself I think that the second statement if evaluate to true is 
>>a success, not a failure...
>>
>>    
>>
>>>Also, how is the result from the service invocation in
>>>$AXISCPP/samples/client/simple/Calculator.cpp returned to the CalcClient
>>>program? In the example taken from the user guide (see below in previous
>>>mail) the values passed to the Calculator method aren't passed by
>>>reference. So how can intOut have *any* other value other than the value
>>>it was instantiated with?!?
>>>
>>>
>>> 
>>>
>>>      
>>>
>>So here, yes you have to add some code...
>>so in the calcultator.cpp you have this line: 
>>m_pCall->AddParameter((void*)&Value2, "addReturn", XSD_INT);
>>try to add a line like this juste after the /*not successful*/
>>Value2 = m_pCall->GetElementAsString("addReturn", 0);
>>this line is for getting the element where the response is...
>>
>>I don't have enought time to explain more...
>>try to make it work with this...
>>
>>    
>>
>>>On Mon, 2004-06-21 at 12:03, Mansart Jean-sebastien wrote:
>>> 
>>>
>>>      
>>>
>>>>Oliver Lyttleton wrote:
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>I'm not sure how I get the Axis C++ Calculator example to work. I know
>>>>>that the files generated by WSDL2ws are skeletons, and must be completed
>>>>>by the user, but I don't know what else needs to be added!
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>You have to write a client that use the class in claculator.cpp
>>>>for example create a file CalcClient.cpp and then fill it with this:
>>>>
>>>>#include "Calculator.h"
>>>>#include<stdio.h>
>>>>int main()
>>>>{
>>>> Calculator c;
>>>> int intOut=0;
>>>> c.add(20, 40, intOut);
>>>> printf("result is = %d\n", intOut);
>>>> return 0;
>>>>}
>>>>
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>For instance, do I need to add anything to
>>>>>$AXISCPP_HOME/samples/client/simple/calculator.cpp
>>>>>in order to get the example to work?
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>see up...
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>Do I need to add anything to
>>>>>$AXISCPP_HOME/samples/server/simple/calculator.cpp?
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>for the server I don't know...
>>>>but read the userguide from the internet... I found the code for the 
>>>>client... so maybe there is something for ther server part too...
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>My question is: what files do I need to add extra code to in order to
>>>>>get the calculator sample to work? And what code should I add?
>>>>>
>>>>>Thanks in advance,
>>>>>
>>>>>Oliver
>>>>>
>>>>>
>>>>>     
>>>>>
>>>>>          
>>>>>
>>> 
>>>
>>>      
>>>
>
>
>  
>


Re: Axis C++ Calculator example

Posted by Oliver Lyttleton <ly...@cs.tcd.ie>.
Sorry, that still doesn't work! Any other suggestions from anybody?!?

On Mon, 2004-06-21 at 15:12, Mansart Jean-sebastien wrote:
> Oliver Lyttleton wrote:
> 
> >On the client side, I'm doing exactly as you're telling me. However, I
> >am unsure as to what should be done on the server side. Also, I'm a
> >little confused by the Calculator.cpp file on the client side....
> >
> >if (AXIS_SUCCESS == m_pCall->Invoke())
> >	{
> >		if(AXIS_SUCCESS == m_pCall->CheckMessage("subResponse",
> >		"http://localhost/axis/Calculator"))
> >		{
> >			/*not successful*/
> >		}
> >	}
> >
> >Does this mean that if the second if statement evaluates to true, the
> >invocation has failed? How is the value for the result of an operation
> >sent back to the client, should code be inserted to do this where the
> >"not successful" comment is? If so, what methods from Call.cpp are used
> >to do this?
> >  
> >
> Yes I know that this part is a little disturbing...
> So, for myself I think that the second statement if evaluate to true is 
> a success, not a failure...
> 
> >Also, how is the result from the service invocation in
> >$AXISCPP/samples/client/simple/Calculator.cpp returned to the CalcClient
> >program? In the example taken from the user guide (see below in previous
> >mail) the values passed to the Calculator method aren't passed by
> >reference. So how can intOut have *any* other value other than the value
> >it was instantiated with?!?
> >
> >
> >  
> >
> So here, yes you have to add some code...
> so in the calcultator.cpp you have this line: 
> m_pCall->AddParameter((void*)&Value2, "addReturn", XSD_INT);
> try to add a line like this juste after the /*not successful*/
> Value2 = m_pCall->GetElementAsString("addReturn", 0);
> this line is for getting the element where the response is...
> 
> I don't have enought time to explain more...
> try to make it work with this...
> 
> >
> >On Mon, 2004-06-21 at 12:03, Mansart Jean-sebastien wrote:
> >  
> >
> >>Oliver Lyttleton wrote:
> >>
> >>    
> >>
> >>>I'm not sure how I get the Axis C++ Calculator example to work. I know
> >>>that the files generated by WSDL2ws are skeletons, and must be completed
> >>>by the user, but I don't know what else needs to be added!
> >>>      
> >>>
> >>You have to write a client that use the class in claculator.cpp
> >>for example create a file CalcClient.cpp and then fill it with this:
> >>
> >>#include "Calculator.h"
> >>#include<stdio.h>
> >>int main()
> >> {
> >>  Calculator c;
> >>  int intOut=0;
> >>  c.add(20, 40, intOut);
> >>  printf("result is = %d\n", intOut);
> >>  return 0;
> >> }
> >>
> >>
> >>    
> >>
> >>>For instance, do I need to add anything to
> >>>$AXISCPP_HOME/samples/client/simple/calculator.cpp
> >>>in order to get the example to work?
> >>>      
> >>>
> >>see up...
> >>
> >>    
> >>
> >>>Do I need to add anything to
> >>>$AXISCPP_HOME/samples/server/simple/calculator.cpp?
> >>>      
> >>>
> >>for the server I don't know...
> >>but read the userguide from the internet... I found the code for the 
> >>client... so maybe there is something for ther server part too...
> >>
> >>    
> >>
> >>>My question is: what files do I need to add extra code to in order to
> >>>get the calculator sample to work? And what code should I add?
> >>>
> >>>Thanks in advance,
> >>>
> >>>Oliver
> >>>
> >>>
> >>>      
> >>>
> >
> >
> >  
> >
> 


Re: Axis C++ Calculator example

Posted by Mansart Jean-sebastien <je...@etu.univ-savoie.fr>.

Oliver Lyttleton wrote:

>On the client side, I'm doing exactly as you're telling me. However, I
>am unsure as to what should be done on the server side. Also, I'm a
>little confused by the Calculator.cpp file on the client side....
>
>if (AXIS_SUCCESS == m_pCall->Invoke())
>	{
>		if(AXIS_SUCCESS == m_pCall->CheckMessage("subResponse",
>		"http://localhost/axis/Calculator"))
>		{
>			/*not successful*/
>		}
>	}
>
>Does this mean that if the second if statement evaluates to true, the
>invocation has failed? How is the value for the result of an operation
>sent back to the client, should code be inserted to do this where the
>"not successful" comment is? If so, what methods from Call.cpp are used
>to do this?
>  
>
Yes I know that this part is a little disturbing...
So, for myself I think that the second statement if evaluate to true is 
a success, not a failure...

>Also, how is the result from the service invocation in
>$AXISCPP/samples/client/simple/Calculator.cpp returned to the CalcClient
>program? In the example taken from the user guide (see below in previous
>mail) the values passed to the Calculator method aren't passed by
>reference. So how can intOut have *any* other value other than the value
>it was instantiated with?!?
>
>
>  
>
So here, yes you have to add some code...
so in the calcultator.cpp you have this line: 
m_pCall->AddParameter((void*)&Value2, "addReturn", XSD_INT);
try to add a line like this juste after the /*not successful*/
Value2 = m_pCall->GetElementAsString("addReturn", 0);
this line is for getting the element where the response is...

I don't have enought time to explain more...
try to make it work with this...

>
>On Mon, 2004-06-21 at 12:03, Mansart Jean-sebastien wrote:
>  
>
>>Oliver Lyttleton wrote:
>>
>>    
>>
>>>I'm not sure how I get the Axis C++ Calculator example to work. I know
>>>that the files generated by WSDL2ws are skeletons, and must be completed
>>>by the user, but I don't know what else needs to be added!
>>>      
>>>
>>You have to write a client that use the class in claculator.cpp
>>for example create a file CalcClient.cpp and then fill it with this:
>>
>>#include "Calculator.h"
>>#include<stdio.h>
>>int main()
>> {
>>  Calculator c;
>>  int intOut=0;
>>  c.add(20, 40, intOut);
>>  printf("result is = %d\n", intOut);
>>  return 0;
>> }
>>
>>
>>    
>>
>>>For instance, do I need to add anything to
>>>$AXISCPP_HOME/samples/client/simple/calculator.cpp
>>>in order to get the example to work?
>>>      
>>>
>>see up...
>>
>>    
>>
>>>Do I need to add anything to
>>>$AXISCPP_HOME/samples/server/simple/calculator.cpp?
>>>      
>>>
>>for the server I don't know...
>>but read the userguide from the internet... I found the code for the 
>>client... so maybe there is something for ther server part too...
>>
>>    
>>
>>>My question is: what files do I need to add extra code to in order to
>>>get the calculator sample to work? And what code should I add?
>>>
>>>Thanks in advance,
>>>
>>>Oliver
>>>
>>>
>>>      
>>>
>
>
>  
>


Re: Axis C++ Calculator example

Posted by Oliver Lyttleton <ly...@cs.tcd.ie>.
On the client side, I'm doing exactly as you're telling me. However, I
am unsure as to what should be done on the server side. Also, I'm a
little confused by the Calculator.cpp file on the client side....

if (AXIS_SUCCESS == m_pCall->Invoke())
	{
		if(AXIS_SUCCESS == m_pCall->CheckMessage("subResponse",
		"http://localhost/axis/Calculator"))
		{
			/*not successful*/
		}
	}

Does this mean that if the second if statement evaluates to true, the
invocation has failed? How is the value for the result of an operation
sent back to the client, should code be inserted to do this where the
"not successful" comment is? If so, what methods from Call.cpp are used
to do this?

Also, how is the result from the service invocation in
$AXISCPP/samples/client/simple/Calculator.cpp returned to the CalcClient
program? In the example taken from the user guide (see below in previous
mail) the values passed to the Calculator method aren't passed by
reference. So how can intOut have *any* other value other than the value
it was instantiated with?!?




On Mon, 2004-06-21 at 12:03, Mansart Jean-sebastien wrote:
> Oliver Lyttleton wrote:
> 
> > I'm not sure how I get the Axis C++ Calculator example to work. I know
> > that the files generated by WSDL2ws are skeletons, and must be completed
> > by the user, but I don't know what else needs to be added!
> 
> You have to write a client that use the class in claculator.cpp
> for example create a file CalcClient.cpp and then fill it with this:
> 
> #include "Calculator.h"
> #include<stdio.h>
> int main()
>  {
>   Calculator c;
>   int intOut=0;
>   c.add(20, 40, intOut);
>   printf("result is = %d\n", intOut);
>   return 0;
>  }
> 
> 
> >
> > For instance, do I need to add anything to
> > $AXISCPP_HOME/samples/client/simple/calculator.cpp
> > in order to get the example to work?
> 
> 
> see up...
> 
> >
> > Do I need to add anything to
> > $AXISCPP_HOME/samples/server/simple/calculator.cpp?
> 
> 
> for the server I don't know...
> but read the userguide from the internet... I found the code for the 
> client... so maybe there is something for ther server part too...
> 
> >
> > My question is: what files do I need to add extra code to in order to
> > get the calculator sample to work? And what code should I add?
> >
> > Thanks in advance,
> >
> > Oliver
> >
> >
> 


Re: Axis C++ Calculator example

Posted by Mansart Jean-sebastien <je...@etu.univ-savoie.fr>.

Oliver Lyttleton wrote:

> I'm not sure how I get the Axis C++ Calculator example to work. I know
> that the files generated by WSDL2ws are skeletons, and must be completed
> by the user, but I don't know what else needs to be added!

You have to write a client that use the class in claculator.cpp
for example create a file CalcClient.cpp and then fill it with this:

#include "Calculator.h"
#include<stdio.h>
int main()
 {
  Calculator c;
  int intOut=0;
  c.add(20, 40, intOut);
  printf("result is = %d\n", intOut);
  return 0;
 }


>
> For instance, do I need to add anything to
> $AXISCPP_HOME/samples/client/simple/calculator.cpp
> in order to get the example to work?


see up...

>
> Do I need to add anything to
> $AXISCPP_HOME/samples/server/simple/calculator.cpp?


for the server I don't know...
but read the userguide from the internet... I found the code for the 
client... so maybe there is something for ther server part too...

>
> My question is: what files do I need to add extra code to in order to
> get the calculator sample to work? And what code should I add?
>
> Thanks in advance,
>
> Oliver
>
>