2009-03-04 3 views
1

Je dois ajouter l'adressage WS dans mon en-tête Soap (j'utilise le framework gsoap). Existe-t-il un moyen d'ajouter cela automatiquement? J'ai regardé la documentation gsoap mais je n'ai trouvé aucune information à ce sujet. Donc maintenant j'ai ajouté manuellement le WS-Addressing à mon SOAP_ENV_Header comme indiqué ci-dessousgsoap - Eléments d'adressage WS dans l'en-tête SOAP

struct SOAP_ENV__Header 
{ 
    mustUnderstand _wsa__MessageID wsa__MessageID 0; 
    mustUnderstand _wsa__RelatesTo *wsa__RelatesTo 0; 
    mustUnderstand _wsa__From *wsa__From 0; 
    mustUnderstand _wsa__ReplyTo *wsa__ReplyTo 0; 
    mustUnderstand _wsa__FaultTo *wsa__FaultTo 0; 
    mustUnderstand _wsa__To wsa__To 0; 
    mustUnderstand _wsa__Action wsa__Action 0; 
}; 

Mais je voudrais générer automatiquement depuis que je dois ajouter d'autres struct à l'en-tête de savon qui sont autogénéré de mon wsdl/xsd fichiers.

Merci

Répondre

1

Vous pouvez définir les SOAP_ENV_Header dans votre typemap.dat comme ceci:

wsa = <http://schemas.xmlsoap.org/ws/2004/08/addressing> 

SOAP_ENV__Header =\ 
#import "wsa.h"\n\ 
struct SOAP_ENV__Header\n\ 
{\n\ 
    mustUnderstand _wsa__MessageID wsa__MessageID 0;\n\ 
    mustUnderstand _wsa__RelatesTo * wsa__RelatesTo 0;\n\ 
    mustUnderstand _wsa__From *  wsa__From  0;\n\ 
    mustUnderstand _wsa__ReplyTo * wsa__ReplyTo 0;\n\ 
    mustUnderstand _wsa__FaultTo * wsa__FaultTo 0;\n\ 
    mustUnderstand _wsa__To   wsa__To  0;\n\ 
    mustUnderstand _wsa__Action  wsa__Action 0;\n\ 
}; 

Utilisez ensuite wsdl2h avec l'option "-t" pour spécifier un typemap.dat externe.

0

Utilisez la connexion d'adressage ws pour gSoap.