I haven't seen any documentation for calling XML-RPC by inputing certain strings and get respone of some strings in c++ by connecting to an XML API. This is a documentation provided by the server. I can't figure out how to do this
A client can interact with a Pandorabot by POST'ing to:
http://www.pandorabots.com/pandora/talk-xml
The form variables the client needs to POST are:
botid - see H.1 above.
input - what you want said to the bot.
custid - an ID to track the conversation with a particular customer. This variable is optional. If you don't send a value Pandorabots will return a custid attribute value in the <result> element of the returned XML. Use this in subsequent POST's to continue a conversation.
This will give a text/xml response. For example:
<result status="0" botid="c49b63239e34d1d5" custid="d2228e2eee12d255">
<input>hello</input>
<that>Hi there!</that>
</result>
The <input> and <that> elements are named after the corresponding AIML elements for bot
input and last response.
If there is an error, status will be non-zero and there will be a human readable <message> element included describing the error.
For example:
<result status="1" custid="d2228e2eee12d255">
<input>hello</input>
<message>Missing botid</message>
</result>
The easiest way to communicate via HTTP in C++ is to use a library designed for that purpose. For example, libcurl provides all the facilities you would need to send and receive the kind of requests and responses you showed in the question.
Related
Hy Guys,
I have a Web service problem. The used environment: SOAP - TOMCAT+AXIS2 - Gigaspace - Magic XPA 3.3
I have made 2 closely same external xpa program what gives back a blob in the Task's property sheet's Return value. It's "answer" back an XML, the simle different is that the first one make (XPA merge) a smaller (18KB) file (from a Filtered DB source), the bigger is write out the whole record aggregation. (1025KB)
When the soap UI receives the first one, everything is fine, i got the result XML on SOAP side. The bigger one shows this error:
With11Endpoint:
<soapenv:Fault>
<faultcode>soapenv:**Server**</faultcode>
<faultstring>**Failed to serialize node**</faultstring>
With12Endpoint:
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:**Receiver**</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">**Failed to serialize node**</soapenv:Text>
</soapenv:Reason>
The only different is the size of files i think so. I have read some option to solve it like BasicHttpBinding's MaxReivedMessageSize and MaxBuffer size, but i could not find them to change values.
Does anyone have experience in this solutions?
Best Regards,
Gábor
For the future. The XML what has sent contained wrong values. Not tipical XML invalid character, instead an character. So i you have a SOAP error like that, try to Validate your XML file to search an option to solve your problem. ;)
How I can call webservice from voice xml (vxml) document. I am using an opensource IVR project and I need to run a webservice for any given option from within the vxml document.
This is similar to this query;
how can I call a webservice from voiceXML?
However, solution is provided there but it is not
You cannot call a web service directly from a VoiceXML application. There are generally two approaches for getting data into a VoiceXML application:
Use the data element tag to make an http request. The result must be XML. You will need to parse the result with the provided DOM functions. Note, some browsers have extended features to facilitate XML parsing. This also requires a VoiceXML 2.1 compliant browser.
Transfer control to a dynamic bit of server code that returns VXML to be processed populating your desired variables. This can be done with a goto element or subdialog element.
Your question is incomplete, but I suspect I know what's bothering you.
I get information from a webservice by using
<data name="return_data" srcexpr="some_url" method="post" namelist="var1 var2 var3" />
The data I get back is inside the return_data variable. In my case, the data are in XML format, and I use JavaScript functions to extract the data I need.
As an aside, for maintainability, re-usability, and ease of reading, I personally find it useful to create separate files for the JS functions and include them via <script> into my root VoiceXML document.
We are recieving soap response with spaces from backend application, when i see in datapower probe unformatted format i can see spaces. But Consumer team are recieving response without spaces from datapower webservice proxy.How can we send the unformatted response or how to preserve whitespaces within the response?
But when i test using soapUI I am getting response as expected with spaces.Please suggest
Actual Result :
<restopic:SequencedText>
<seqtxt:Sequence>00010</seqtxt:Sequence>
<seqtxt:Text>% LOB: Facility, Professional Effective Date: 07/11/97</seqtxt:Text>
</restopic:SequencedText>
Expected Result :
<restopic:SequencedText>
<seqtxt:Sequence>00010</seqtxt:Sequence>
<seqtxt:Text>% LOB: Facility, Professional Effective Date: 07/11/97</seqtxt:Text>
</restopic:SequencedText>
Thanks in Advance!!
First of all, don't trust the probe!
It will format messages according to what it "thinks" is correct and spaces might "disappear".
Make a XML File capture in the default domain and grab the archives from there to see how it really looks!
DataPower won't touch the XML element values so my guess is that it's either something happening after the message leaving DataPower or some conversion of character code or something messing up your spaces.
In the file capture you will be able to see both incoming and outgoig message and then you'll know how it looks.
I'm making raw SOAP requests to Office365 and trying to get a list of contacts for specified AddressListId I successfully get a list of contacts, but it does not include all additional information I need. Once I add some additional properties (e.g. PhoneNumber) to my request, the server returns Invalid shape error.
Here is my request:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body >
<m:FindPeople>
<m:PersonaShape>
<t:BaseShape>IdOnly</t:BaseShape>
<t:AdditionalProperties>
<t:FieldURI FieldURI="persona:DisplayName"/>
<t:FieldURI FieldURI="persona:PhoneNumber"/>
</t:AdditionalProperties>
</m:PersonaShape>
<m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="100" Offset="0"/>
<m:ParentFolderId>
<t:AddressListId Id="###-####-####-####"/>
</m:ParentFolderId>
</m:FindPeople>
</soap:Body>
</soap:Envelope>
How can I get all additional information for each persona?
I am using EWS Managed API, so you will have to search for the raw SOAP calls on MSDN, I can only direct your search a bit:
I had a similar problem, because the very same is applicable for FindAppointments(). Asking for AppointmentSchema.RequiredAttendees will raise the Invalid Shape error, and AppointmentSchema.Organizer won't contain the email address, only the name of the organizer, after using FindAppointments().
The solution was to do TWO requests to Exchange Server.
var appointments = calendarFolder.FindAppointments(BasePropertySet.FirstClassProperties);
exchangeService.LoadPropertiesForItems(appointments, MyAdvancedProperties);
I think that the same "workaround" is possible with FindPeople(), as well as every other Find%Itemtype%() EWS may support, I am not sure, though.
EDIT: I just found http://social.technet.microsoft.com/Forums/exchange/en-US/e83abfb1-37a8-48fe-9579-4e120fb77746/ews-managed-api-loadpropertiesforitems-returns-unexpected-end-of-xml-document?forum=exchangesvrdevelopment where it is stated that LoadPropertiesForItems does a call to raw soap GetItem with multiple ItemIDs.
I am using RestWebservice for few basic operations , like creating/searching. The request xml looks something like this
<customer>
<name/>
.....
</customer>
For a successful operation I return the same customer XML with extra fields populated in it(eg. systemId etc which we blank in the request) .
with Response.Status=2000
For an unsuccessful operation i return something like this with different error codes .
e.g Response.Status = 422(Unprocessable entity)
Response.Status= 500(Internal Server Error) and few others..
<errors>
<error> An exception occurred while creating the customer</error>
<error> blah argument is not valid.</error>
</errors>
Now i am not sure , whether this is the correct way of sending the errors to the client. Maybe it should be present in the header of the response.
I will really appreciate any help.
Thanks!
The correct REST approach for errors is to use the HTTP status codes (as it sounds like you are doing). There is a bewildering array of them (as you can see here) and you might be surprised to see how many may fit most common situations.
As far as friendly error messages, you have 2 choices. First, you can provide a text description of the status code after the status code in the HTTP response (see the Wikipedia article on HTTP for more info). This text is determined by the server--not the HTTP specification--and gives you some flexibility in the specific message you send; most server-side frameworks give you a way to set this text programatically. However! It is a best practice not to abuse the status code description, because you can't guarantee that the user's web client will read it or not (in favor of reading only the status code and using the standard HTTP descriptions). I would only recommend using this approach if your status descriptions are simple and you control the server and the client (so you know what you are getting). In my experience, this approach works pretty well for the 5xx range of codes, but I wouldn't use it for much else.
Your second option is what you are already doing: to return an error status code and a description of the error as the body of the message. That is a best practice; if it is working for you, no need to change. It is probably helpful to think of this as "additional information the errors" rather than the error message itself (which would be the text after the status code in the HTTP response).
I'd wrap the XML in "Request" or "Response" wrappers.
E.g.,
<customerrequest>
<customer>
..
</customer>
</customerrequest>
and more importantly:
<customerresponse>
<status>success | failure</status>
<customer> <!-- If success -->
...
</customer>
<errors> <!-- If failure -->
<!-- never underestimate the value of having a machine-friendly error code
for each possible error, or critical/non-critical errors -->
<error code="0001">An error occurred</error>
</errors>
</customerresponse>
This also means that as your service matures, you can add extra non-data fields as required within the request/response tags. Or a reference number. Or authentication details.
If you were using SOAP, you could use the existing error handling that SOAP has built-in, although I have personally found it rather restricted (not that I investigated too deeply).