0

i am trying to consume wcf services using acrobat javascript's soap object. i've got it to work without issues. below is the javascript code that works fine.

var repliconCredentials = {
    Username: "valid username",
    Password: "valid password"
};

var reqParam = {
    'http://replicon.com/:activity': {
        'http://replicon.com/:target': {
            'http://replicon.com/:uri': null,
            'http://replicon.com/:name': 'test activity'
        },
        'http://replicon.com/:name': 'test activity',
        'http://replicon.com/:code': null,
        'http://replicon.com/:description': null
    }
};

var response = SOAP.request({
    cURL: "https://na2.replicon.com/services/ActivityService1.svc/soap",
    oRequest: { "http://replicon.com/:PutActivity": reqParam },
    cAction: "http://replicon.com/IActivityService1/PutActivity",
    oAuthenticate: repliconCredentials
});

this successfully creates "test activity" in Replicon.

if you notice the reqParam i have had to prefix namespace for each type in the request. if i don't do that the request doesn't work. in fiddler i see that the object literal reqParam is converted to xml request.

  • what is the best way to prefix namespace? i have tried cNamespace property of SOAP.request method and that doesn't work because it isn't applicable when using SOAP encoding (default).
  • is there any other recommended way to create and pass requests. i am building an acrobat plugin using javascript objects. should i try to pass in native xml format? if so, how?

the plain request (json format) looks as below. { "activity": { "target": { "uri": null, "name": "test activity" }, "name": "test activity", "code": null, "description": null } }

the wsdl url is https://na2.replicon.com/services/ActivityService1.svc?wsdl

1 Answers1

0

Not sure I fully understand the question, so as an example, following is a typical call I would make to a SharePoint server. Not at work today but I have many more resources there if you don't find an answer today...

soapResponse = SOAP.request({
  cNamespace: 'http://schemas.microsoft.com/sharepoint/soap/' + soapAction + 'Response',
  cURL: 'http://server/folder/_vti_bin/Lists.asmx',
  oRequest: {soapValue: soapEnv},
  cAction: 'http://schemas.microsoft.com/sharepoint/soap/' + soapAction,
  oAuthenticator: {UsePlatformAuth: 'true'},
  bEncoded: false,
  cVersion: SOAPVersion.version_1_2,
  cResponseStyle: SOAPMessageStyle.Message
});
WhiteHat
  • 59,912
  • 7
  • 51
  • 133
  • thanks for your reply. if you look at reqParam in my question i've had to prefix the namespace for each type explicitly. can the namespace be specified in a better way instead of repeating so many times? – shamanth Gowdra Shankaramurthy Aug 03 '15 at 18:34