Third party/EasySoap++-0.6.1/tests/interopclient.cpp
/////////////////////////////////////////////////////////////////////////////////
//
// Round 2 Group C methods
//
//
// echoHdrString
// echoHdrStruct
//
// Variations:
//  mustUnderstand = "1", "0"
//  namespace = "http://soapinterop.org/echoheader/", other
//  actor = none (default), next, other
//
/////////////////////////////////////////////////////////////////////////////////
Round 2 Group C methods
echoHdrString
echoHdrStruct


Round 2 Group C methods echoHdrString echoHdrStruct
void
TestEchoHdrString(SOAPProxy& proxy, const Endpoint& e,
				  bool mustUnderstand,
				  bool understandable,
				  int actor)
{
	static const char *headerNamespace = "http://soapinterop.org/echoheader/";
	static const char *otherNamespace = "http://other.soapinterop.org/echoheader/";
	SOAPQName headname("echoMeStringRequest", understandable ? headerNamespace : otherNamespace);
	SOAPEnvelope env;
	SOAPParameter& header = env.GetHeader().AddHeader(headname);
	SOAPMethod& method = env.GetBody().GetMethod();
	method.SetName("echoVoid", e.nspace);
	method.SetSoapAction(e.soapaction);
	SOAPString str = "This is a string in the header";
	header << str;
	header.AddAttribute(SOAPEnv::mustUnderstand) = mustUnderstand ? "1" : "0";
	if (actor == 1)
		header.AddAttribute(SOAPEnv::actor) = SOAPHeader::actorNext;
	else if (actor == 2)
		header.AddAttribute(SOAPEnv::actor) = "http://jackandjill.com/wentup/thehill";
	const SOAPResponse& response = proxy.Execute(env);
	if (understandable && actor != 2)
	{
		SOAPQName rheadname("echoMeStringResponse", understandable ? headerNamespace : otherNamespace);
		const SOAPParameter& rhead = response.GetHeader().GetHeader(rheadname);
		SOAPString rstr;
		rhead >> rstr;
		if (rstr != str)
			throw SOAPException("Values are not equal: '%s' and '%s'",
				(const char *)str,
				(const char *)rstr);
	}
}
void TestEchoHdrString ( SOAPProxy & proxy , const Endpoint & e , bool mustUnderstand , bool understandable , int actor ) { static const char * headerNamespace = " " ; static const char * otherNamespace = " " ; SOAPQName headname ( " " , understandable ? headerNamespace : otherNamespace ) ; SOAPEnvelope env ; SOAPParameter & header = env . GetHeader ( ) . AddHeader ( headname ) ; SOAPMethod & method = env . GetBody ( ) . GetMethod ( ) ; method . SetName ( " " , e . nspace ) ; method . SetSoapAction ( e . soapaction ) ; SOAPString str = " " ; header << str ; header . AddAttribute ( SOAPEnv :: mustUnderstand ) = mustUnderstand ? " " : " " ; if ( actor == 1 ) header . AddAttribute ( SOAPEnv :: actor ) = SOAPHeader :: actorNext ; else if ( actor == 2 ) header . AddAttribute ( SOAPEnv :: actor ) = " " ; const SOAPResponse & response = proxy . Execute ( env ) ; if ( understandable && actor != 2 ) { SOAPQName rheadname ( " " , understandable ? headerNamespace : otherNamespace ) ; const SOAPParameter & rhead = response . GetHeader ( ) . GetHeader ( rheadname ) ; SOAPString rstr ; rhead >> rstr ; if ( rstr != str ) throw SOAPException ( " " , ( const char * ) str , ( const char * ) rstr ) ; } }
Round 2 Group C methods
echoHdrString
echoHdrStruct
Round 2 Group C methods echoHdrString echoHdrStruct