I'm trying to create a group using the rest API of windows azure Graph for Office365. I'm pass the xml payload to the url https://graph.windows.net/49aa83c813-59c999-4e29-a753-25fd8caebe93/Group
The payLoad which I'm passing is
<?xml version="1.0" encoding="UTF-8" standalone="no"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><content type="application/xml"><m:properties><d:DisplayName>testingGroup</d:DisplayName><d:Description>Test group</d:Description><d:MailEnabled>true</d:MailEnabled><d:DirSyncEnabled>false</d:DirSyncEnabled><d:SecurityEnabled>false</d:SecurityEnabled><d:ObjectType>Group</d:ObjectType><d:MailNickname>firstGroup</d:MailNickname><d:Mail>firstGroup#companyName.us</d:Mail></m:properties></content></entry>
I receive a 400 Error as a response. Will anyone be able to tell me the correct XML payLoad to pass.
First, your request URI is incorrect. For creating a group using version 0.8 of the Graph API, it should be in this format:
https://graph.windows.net/yourtenantdomainname.com/Group
Your tenant might also be an *.onmicrosoft.com address. A couple other things: the service currently doesn't support setting the DirSyncEnabled or Mail properties. They are both read-only. And currently you need to have MailEnabled set to false and SecurityEnabled set to true.
To create a group using 0.8 version, this is what your request will look like:
POST https://graph.windows.net/yourtenantname.com/Groups HTTP/1.1
Authorization: Bearer eyJ0eXAiOiJK...vYiFqfkg
Host: graph.windows.net
Content-Type: application/atom+xml
x-ms-dirapi-data-contract-version: 0.8
Content-Length: 725
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<content type="application/xml">
<m:properties>
<d:DisplayName>testingGroup</d:DisplayName>
<d:Description>Test group</d:Description>
<d:MailEnabled>false</d:MailEnabled>
<d:ObjectType>Group</d:ObjectType>
<d:SecurityEnabled>true</d:SecurityEnabled>
<d:MailNickname>firstGroup</d:MailNickname>
</m:properties>
</content>
</entry>
Note that 0.9 of the Graph API was released recently: http://blogs.msdn.com/b/aadgraphteam/archive/2013/03/03/0-9-version-of-azure-active-directory-graph-now-available.aspx
If you want to create a group using the latest version of the API, this is how your request would look using XML as the payload (note the camelCase properties and "group" in the URI):
POST https://graph.windows.net/yourtenantname.com/groups?api-version=0.9 HTTP/1.1
Authorization: Bearer eyJ0eXAi...YiFqfkg
Host: graph.windows.net
Content-Type: application/atom+xml
Content-Length: 627
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<content type="application/xml">
<m:properties>
<d:displayName>testingGroup</d:displayName>
<d:description>Test group</d:description>
<d:mailEnabled>false</d:mailEnabled>
<d:objectType>Group</d:objectType>
<d:securityEnabled>true</d:securityEnabled>
<d:mailNickname>firstGroup</d:mailNickname>
</m:properties>
</content>
</entry>
And finally just for fun, if you want to use the new supported minimal JSON the payload would look like this:
{
"displayName": "testingGroup",
"description": "Test group",
"mailNickname": "firstGroup",
"mailEnabled": false,
"securityEnabled": true
}
Related
I want to call drools via kie server per REST-Call.
I created a container with runtime strategy "Singleton" without Kie Basis Name and without Kie Session Name.
Here is my rest call:
- URL: http://10.199.0.211:8080/kie-server-6.5.0.Final-ee7/services/rest/server/containers/instances/test1
- Authorization: basic
- Header: Content-Type: application/xml
Body:
<batch-execution lookup="defaultKieSession">
<insert out-identifier="message" return-object="true" entrypoint="DEFAULT">
<de.salt.d4s.test2.test2.input>
<order>1</order>
</de.salt.d4s.test2.test2.input>
</insert><fire-all-rules></fire>
</batch-execution>
I get this result:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="FAILURE" msg="Error calling container test1: Session
'defaultKieSession' not found on container 'test1'."/>
I tried to do this with a "kie session name" in process-configuration but got the same error.
What can I do to solve this?
Thank you!
Michael
Check if, in the directory resources/META-INF, the file kmodule.xml contains a default ksession, if not you can place it:
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<kbase name="myBase" default="true">
<ksession name="mySession" type="stateless" default="true" clockType="realtime"/>
<ksession name="mySession2" default="true" clockType="realtime"/>
</kbase>
</kmodule>
For more details about the xml values you can take a look here:
https://docs.jboss.org/drools/release/6.2.0.CR3/drools-docs/html/KIEChapter.html#d0e1533
I have a web service consumer in a flow and simply want to extract the XML contained in the soap envelope to be put on the outbound vm queue. How can I accomplish that in a flow, I have shown a sample of the soap message;
<ws:consumer-config name="WS_Connector"
connector-ref="HTTP_HTTPS" wsdlLocation="orderService.wsdl"
service="OrderService" port="OrderServiceWS"
serviceAddress="http://ws-orders.com?responseTimeout=60000"
doc:name="Web Service Consumer" />
<flow name="mainFlow">
<vm:inbound-endpoint path="request.queue"/>
<ws:consumer config-ref="WS_Connector"
operation="orderTShirts" doc:name="TShirt Service Consumer">
</ws:consumer>
<!-- Get Just the XML Payload without the Soap Envelope
for the vm outbound queue
<tshirt xmlns="http://www.webservice.order-service">
<size>17</size>
<color>red</color>
</tshirt>
-->
<vm:outbound-endpoint path="response.queue"/>
</flow>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<tshirt xmlns="http://www.webservice.order-service">
<size>17</size>
<color>red</color>
</tshirt>
</soap:Body>
</soap:Envelope>
The web-service-consumer is designed to only accept the body/operation part of the XML document and will produce body/operation in response.
Pls go through the dataweave document :- https://docs.mulesoft.com/mule-user-guide/v/3.7/web-service-consumer
What you can do here use XSLT transforer or DataWeave to add your soap envelope after your <ws:consumer/> in the response something like following example :-
<!-- your code above -->
<ws:consumer config-ref="WS_Connector" operation="orderTShirts" doc:name="TShirt Service Consumer"/>
<dw:transform-message doc:name="XML to JSON" >
<dw:input-payload doc:sample="ListInventoryResponse.xml"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/xml
%namespace ns0 http://mulesoft.org/tshirt-service
%namespace soap http://schemas.xmlsoap.org/soap/envelope/
---
soap#Envelope : {
soap#Body:payload
}]]></dw:set-payload>
</dw:transform-message>
The solution I found is quite simple
<mulexml:dom-to-xml-transformer doc:name="SOAP Response to XML" encoding="UTF-8" mimeType="application/xml" outputEncoding="UTF-8"/>
I'm trying to create an event using REST within IBM Connections 4.5, I've used the IBM Connections API documentation, but when I post the request I get an Error 500, and no error message is returned. The Atom document I am passing is:
<?xml version="1.0" encoding="UTF-8"?>
<entry
xmlns="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">ST0809</title>
<content type="html"><![CDATA[ Description ]]></content>
<category term="event" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<snx:recurrence scheme="http://www.ibm.com/xmlns/prod/sn" custom="yes">
<snx:period scheme="http://www.ibm.com/xmlns/prod/sn">
<snx:startDate scheme="http://www.ibm.com/xmlns/prod/sn">2014-06-23T08:00:00.000Z</snx:startDate>
<snx:endDate scheme="http://www.ibm.com/xmlns/prod/sn">2014-06-23T09:00:00.000Z</snx:endDate>
</snx:period>
</snx:recurrence>
</entry>
I am posting to the URL "/communities/calendar/atom/calendar/event?calendarUuid=" with the uuid filled in obviously.
Anyone have any ideas?
There is an error in the IBM documentation, it is missing a couple of things (the documentation doesn't mention snx:period for example).
Here's the working version, notice that allday has been added.
<entry
xmlns="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">ST0809</title>
<content type="html"><![CDATA[ Description ]]></content>
<snx:allday>0</snx:allday>
<category term="event" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<snx:recurrence scheme="http://www.ibm.com/xmlns/prod/sn" custom="yes">
<snx:period scheme="http://www.ibm.com/xmlns/prod/sn">
<snx:startDate scheme="http://www.ibm.com/xmlns/prod/sn">2014-06-23T08:00:00.000Z</snx:startDate>
<snx:endDate scheme="http://www.ibm.com/xmlns/prod/sn">2014-06-23T09:00:00.000Z</snx:endDate>
</snx:period>
</snx:recurrence>
</entry>
I have been given a REST URI from my client which is as follows:
https://vm3.digitary.net/verifier/HEDDRequestDocumentAccess
Following request xml has to be POSTed to the above URI to get the response xml.
<documentAccessRequest xmlns="http://www.digitary.net/schema/dare/hedd/documentAccessRequest/2013" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.digitary.net/schema/dare/hedd/documentAccessRequest/2013 http://www.digitary.net/schema/dare/hedd/documentAccessRequest/2013">
<head>
<institutionCode>BBCU</institutionCode>
<username>HEDDUser</username>
<password>HEDDPass</password>
</head>
<body>
<heddEnquiryId>12347895844</heddEnquiryId>
<enquiree>
<email>jane#doe.com</email>
<firstName>Jane</firstName>
<lastName>Doe</lastName>
</enquiree>
<enquirer>
<organisation>BBC</organisation>
<contactName>Jeremy Clarkson</contactName>
</enquirer>
<documentRequested>HEAR</documentRequested>
</body>
</documentAccessRequest>
Now I have the requirement to make my own wrapper REST API in WSO2 ESB 4.6.0 which would simply call the above mentioned REST URI having the same request and response XML. The idea is to make the pass through REST API to above mentioned API.
I have implemented the following REST API:
<api xmlns="http://ws.apache.org/ns/synapse" name="TestDareRest" context="/documentRequest" hostname="46.137.187.137" port="8280">
<resource methods="POST" url-mapping="/request/*">
<inSequence>
<log/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<send>
<endpoint>
<address uri="https://vm3.digitary.net/verifier/HEDDRequestDocumentAccess" format="pox"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log/>
<property name="ContentType" value="application/xhtml+xml" scope="axis2"/>
<send/>
</outSequence>
</resource>
</api>
But above API is not working at all and it is gving loads of errors in the esb console. I am using the SOAPUI to test this REST service and posting the same request xml from there. The service is deployed on our public Ip server and can be seen by login in to following
https://46.137.187.137:9443/carbon/admin/index.jsp with username/pwd as admin/admin
I have tried setting both media type in SOAPUI as text/xml and application/xml
In case of text/xml it is giving error as follows:
org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found documentAccessResponse
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)
In case of application/xml it is giving following error
INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:53a782ab-2081-4cb1-9e94-910b75816361, Direction: response
[2013-04-10 16:05:12,911] ERROR - PassThroughHttpSender Failed to submit the response
java.lang.UnsupportedOperationException
Please help me with this issue as it has got much critical to me.
Thanks in Advance
Shakshi
Can you switch the transport to nonblocking transport and check?
You can change the transport sender and receiver in the axis2.xml.
The media type is to be application/xml ..not the text/xml, which is used fro soap requests.
To post a request you can use curl utility.
# curl -X POST -d #request.xml "URL"
I am working with an API that has two different URLs for specific types of functions. The first, is a transactional API that supports either JSON or SOAP requests. I have called all of the functions I need within this API using exclusively JSON calls and everything appears to be working perfectly fine.
The second is a reporting API used to locate and/or download reports. This API works exclusively with SOAP. I have not been able to get any function in this API working properly. I have attempted to contact the company's support group, but they do not have anybody who can assist me with API calls in ColdFusion. I have attempted two different ways to interface with this API and get access to the functions and have come up empty. Below are my examples and as much information as I can provide; our service provider's API and associated documentation are confidental, but I can answer some questions related to specific things that have to do with my code.
Way 1: Creating a webservice object.
The first way I tried to create this SOAP call was through a webservice object. Using the metadata exchange point URL, I passed it into the createObject function like this:
<cfset argStruct = structNew() />
<cfset argStruct['username'] = 'myusername' />
<cfset argStruct['password'] = 'mypassword' />
<cfset testSvc = createObject('webservice','https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/mex',argStruct) />
When I run this code, I get the following error message:
Cannot generate stub objects for web service invocation. Name: https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/mex. WSDL: https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/mex. javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:import): faultCode=OTHER_ERROR: Unable to resolve imported document at 'https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/mex?wsdl=wsdl1', relative to 'brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/': java.io.IOException: Server returned HTTP response code: 401 for URL: https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/mex?wsdl=wsdl1
Since 401 errors are typically bad authorizations, I double-checked the address by calling the URL directly in the browser, where I was prompted with a UN/PW. I entered in my values, and was allowed to access the URL, recieving this XML in return:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="ReportingAPI" targetNamespace="https://https://brandnameapi.serviceprovider.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="https://https://brandnameapi.serviceprovider.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:i0="https://https://brandnameapi.serviceprovider.com/ReportingAPI/soapBinding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<wsdl:import namespace="https://https://brandnameapi.serviceprovider.com/ReportingAPI/soapBinding" location="https://https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/mex?wsdl=wsdl1"/>
<wsdl:types/>
<wsdl:service name="ReportingAPI">
<wsdl:port name="BasicHttpBinding_IReportingAPI" binding="i0:BasicHttpBinding_IReportingAPI">
<soap:address location="https://https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/soap"/>
</wsdl:port>
</wsdl:service>
This is about as far as I've gotten. When I call the URL with my browser and pass the authentication information, I'm allowed to access the XML. When I try to do so with ColdFusion, I get 401 errors.
Way 2: cfhttp request calls
When I switched to using cfhttp, I seemed to get a little further. When I use this:
<cfhttp url="https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/mex"
username="myusername" password="mypassword" method="get" result="httpResponse"
timeout="300">
</cfhttp>
httpResponse return appropriate page information, and httpResponse.filecontent returns the same XML I recieved when I called it directly in my browser.
Going one step further, I took the SOAP URL and attempted to call a function in the API that returns a list of available report files. I used the same known-working process I used for all of my JSON calls in the transaction API:
<cfhttp url="https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/soap/queryAvailableReportFiles"
username="myusername" password="mypassword" method="post"
result="httpResponse" timeout="300">
<cfhttpparam type="formfield" name="typeOfReport" value="DailyCSVFile" />
</cfhttp>
When I run this code, I get a status code of 415 and an error of, 'Cannot process the message because the content type 'application/x-www-form-urlencoded' was not the expected type 'multipart/related; type="application/xop+xml"'
When I add this line between my cfhttps:
<cfhttpparam type="header" name="Content-Type" value='multipart/related; type="application/xop+xml"' />
I get the same error as directly above, but the status code changes to 400. I have not included everything I've tried to do, only where I'm at right now. I will answer as many questions as I can and will reperform steps as directed to find a solution to this problem.
Update: As requested, I have changed the cfhttp call to attempt to pass XML instead of a form field. My XML code is ripped directly from the API documentation that has an example of a raw data for a request from the API for a different function:
<cfsavecontent variable="soapBody">
<cfoutput>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<queryAvailableReportFiles
xmlns="https://brandnameapi.sandbox.serviceprovider.com/contract">
<fileName>DailyCSVFile</fileName>
</queryAvailableReportFiles>
</s:Body>
</s:Envelope>
</cfoutput>
</cfsavecontent>
<cfhttp url="https://prismproapi.sandbox.koretelematics.com/4/ReportingAPI.svc/soap/queryAvailableReportFiles" username="vfapi" password="bPzqQyK3" method="post" result="httpResponse" timeout="300">
<cfhttpparam type="xml" value="#trim(soapBody)#" />
</cfhttp>
To be fair, I have no idea if I'm doing that right. The error message that returns from it is, "The message with To https://prismproapi.sandbox.koretelematics.com/4/ReportingAPI.svc/soap/queryAvailableReportFiles cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree." I also get a 500 error.
Here is an example of how I typically compose and execute my SOAP requests. Note that you will need to modify the SOAP body to fit your API's needs. Hopefully this will help lead you in the right direction.
By the way, Ben Nadel has an excellent right up on Making SOAP Web Service Requests With ColdFusion And CFHTTP
Here is my sample code:
<!--- Compose SOAP message to send to Web Service --->
<cfsavecontent variable="soapRequest">
<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:example="http://www.domain.com/soap/example/">
<soapenv:Header/>
<soapenv:Body>
<example:ReportAPI>
<typeOfReport>DailyCSVFile</typeOfReport>
</example:ReportAPI>
</soapenv:Body>
</soapenv:Envelope>
</cfsavecontent>
<!--- Send SOAP request to the Web Service --->
<cfhttp url="https://brandnameapi.sandbox.serviceprovider.com/vernum/ReportingAPI.svc/soap/queryAvailableReportFiles" username="myusername" password="mypassword" method="post" result="httpResponse" timeout="300">
<cfhttpparam type="header" name="content-type" value="text/xml" />
<cfhttpparam type="header" name="content-length" value="#Len(Trim(soapRequest))#" />
<cfhttpparam type="header" name="charset" value="utf-8" />
<cfhttpparam type="xml" name="message" value="#Trim(soapRequest)#" />
</cfhttp>
There was a problem with their API. No code change would have addressed this issue.