Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Commit

Permalink
Clean windows build with overarching SimpleSOAPRequestor
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/xml/security/trunk@351037 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Berin Lautenbach committed Apr 21, 2004
1 parent cee8e4a commit 76ffeaa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 116 deletions.
12 changes: 8 additions & 4 deletions c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions c/src/utils/winutils/XSECBinHTTPURIInputStream.hpp
Expand Up @@ -30,6 +30,9 @@
* $Id$
*
* $Log$
* Revision 1.6 2004/04/21 10:14:49 blautenb
* Clean windows build with overarching SimpleSOAPRequestor
*
* Revision 1.5 2004/04/16 12:07:23 blautenb
* Skeleton code for XKMS MessageFactory
*
Expand Down Expand Up @@ -67,7 +70,7 @@
struct hostent;
struct sockaddr;

class XSECSOAPRequestorSimpleWin32;
class XSECSOAPRequestorSimple;

class DSIG_EXPORT XSECBinHTTPURIInputStream : public XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream
{
Expand All @@ -81,7 +84,7 @@ public :

static void Cleanup();

friend XSECSOAPRequestorSimpleWin32;
friend class XSECSOAPRequestorSimple;

protected:

Expand Down
113 changes: 3 additions & 110 deletions c/src/utils/winutils/XSECSOAPRequestorSimpleWin32.cpp
Expand Up @@ -25,11 +25,11 @@
*
*/

#include "XSECSOAPRequestorSimpleWin32.hpp"

#include <xsec/utils/winutils/XSECBinHTTPURIInputStream.hpp>
#include <xsec/framework/XSECError.hpp>
#include <xsec/utils/XSECSafeBuffer.hpp>
#include <xsec/utils/XSECSOAPRequestorSimple.hpp>
#include <xsec/utils/XSECDOMUtils.hpp>
#include <xsec/xkms/XKMSConstants.hpp>

Expand Down Expand Up @@ -57,131 +57,24 @@

XERCES_CPP_NAMESPACE_USE

// --------------------------------------------------------------------------------
// Strings for constructing SOAP envelopes
// --------------------------------------------------------------------------------

static XMLCh s_prefix[] = {

chLatin_e,
chLatin_n,
chLatin_v,
chNull
};

static XMLCh s_Envelope[] = {

chLatin_E,
chLatin_n,
chLatin_v,
chLatin_e,
chLatin_l,
chLatin_o,
chLatin_p,
chLatin_e,
chNull
};

static XMLCh s_Header[] = {

chLatin_H,
chLatin_e,
chLatin_a,
chLatin_d,
chLatin_e,
chLatin_r,
chNull
};

static XMLCh s_Body[] = {

chLatin_B,
chLatin_o,
chLatin_d,
chLatin_y,
chNull
};

// --------------------------------------------------------------------------------
// Constructors and Destructors
// --------------------------------------------------------------------------------


XSECSOAPRequestorSimpleWin32::XSECSOAPRequestorSimpleWin32(const XMLCh * uri) : m_uri(uri) {
XSECSOAPRequestorSimple::XSECSOAPRequestorSimple(const XMLCh * uri) : m_uri(uri) {

XSECBinHTTPURIInputStream::ExternalInitialize();

}

XSECSOAPRequestorSimpleWin32::~XSECSOAPRequestorSimpleWin32() {
}


// --------------------------------------------------------------------------------
// Wrap and serialise the request message
// --------------------------------------------------------------------------------

char * XSECSOAPRequestorSimpleWin32::wrapAndSerialise(DOMDocument * request) {

// Create a new document to wrap the request in

XMLCh tempStr[100];
XMLString::transcode("Core", tempStr, 99);
DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);

safeBuffer str;

makeQName(str, s_prefix, s_Envelope);

DOMDocument *doc = impl->createDocument(
XKMSConstants::s_unicodeStrURISOAP11,
str.rawXMLChBuffer(),
NULL);// DOMDocumentType()); // document type object (DTD).

DOMElement *rootElem = doc->getDocumentElement();

makeQName(str, s_prefix, s_Body);
DOMElement *body = doc->createElementNS(
XKMSConstants::s_unicodeStrURISOAP11,
str.rawXMLChBuffer());

rootElem->appendChild(body);

// Now replicate the request into the document
DOMElement * reqElement = (DOMElement *) doc->importNode(request->getDocumentElement(), true);
body->appendChild(reqElement);

// OK - Now we have the SOAP request as a document, we serialise to a string buffer
// and return

DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();

theSerializer->setEncoding(MAKE_UNICODE_STRING("UTF-8"));
if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false))
theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false);

MemBufFormatTarget *formatTarget = new MemBufFormatTarget;
theSerializer->writeNode(formatTarget, *doc);

// Now replicate the buffer
char * ret = XMLString::replicate((const char *) formatTarget->getRawBuffer());

delete theSerializer;
delete formatTarget;

doc->release();

return ret;
}



// --------------------------------------------------------------------------------
// Interface
// --------------------------------------------------------------------------------


DOMDocument * XSECSOAPRequestorSimpleWin32::doRequest(DOMDocument * request) {
DOMDocument * XSECSOAPRequestorSimple::doRequest(DOMDocument * request) {


char * content = wrapAndSerialise(request);
Expand Down

0 comments on commit 76ffeaa

Please sign in to comment.