I am trying to develop code to use a webservice. The documentation is here: https://app.foliosdigitalespac.com/CR33Test/ConexionRemota.svc. Specifically I want to use the method GenerarTicket.
If I use this tool and provide the link above I can generate an XML for this specific method. This is the generated XML.
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/"
xmlns:tes="http://schemas.datacontract.org/2004/07/TES.V33.CFDI.Negocios">
<soapenv:Header/>
<soapenv:Body>
<tem:GenerarTicket>
<!--Optional:-->
<tem:credenciales>
<!--Optional:-->
<tes:Cuenta>TES030201001</tes:Cuenta>
<!--Optional:-->
<tes:Password>TES030201001j+2020</tes:Password>
<!--Optional:-->
<tes:Usuario>TES030201001</tes:Usuario>
</tem:credenciales>
<!--Optional:-->
<tem:ticket>
<!--Optional:-->
<tes:ClaveCFDI>FAC</tes:ClaveCFDI>
<!--Optional:-->
<tes:Conceptos>
<!--Zero or more repetitions:-->
<tes:ConceptoR>
<!--Optional:-->
<tes:Cantidad>2</tes:Cantidad>
<!--Optional:-->
<tes:ClaveProdServ>84111506</tes:ClaveProdServ>
<!--Optional:-->
<tes:ClaveUnidad>C81</tes:ClaveUnidad>
<!--Optional:-->
<!--Optional:-->
<tes:Descripcion>Producto 1</tes:Descripcion>
<!--Optional:-->
<tes:Importe>0.09</tes:Importe>
<!--Optional:-->
<tes:NoIdentificacion>1234567890</tes:NoIdentificacion>
<!--Optional:-->
<tes:Unidad>ACT</tes:Unidad>
<!--Optional:-->
<tes:ValorUnitario>0.045</tes:ValorUnitario>
<!--Optional:-->
</tes:ConceptoR>
<tes:ConceptoR>
<!--Optional:-->
<tes:Cantidad>5</tes:Cantidad>
<!--Optional:-->
<tes:ClaveProdServ>84111506</tes:ClaveProdServ>
<!--Optional:-->
<tes:ClaveUnidad>C81</tes:ClaveUnidad>
<!--Optional:-->
<tes:Descripcion>Producto 2</tes:Descripcion>
<!--Optional:-->
<tes:Importe>0.02</tes:Importe>
<!--Optional:-->
<tes:NoIdentificacion>001</tes:NoIdentificacion>
<!--Optional:-->
<tes:Unidad>ACT</tes:Unidad>
<!--Optional:-->
<tes:ValorUnitario>0.004</tes:ValorUnitario>
<!--Optional:-->
</tes:ConceptoR>
</tes:Conceptos>
<!--Optional:-->
<tes:CondicionesDePago>Condiciones De Pago</tes:CondicionesDePago>
<!--Optional:-->
<!--Optional:-->
<tes:Emisor>
<!--Optional:-->
<tes:Nombre>Nombre del Emisor</tes:Nombre>
<!--Optional:-->
<tes:RegimenFiscal>601</tes:RegimenFiscal>
</tes:Emisor>
<!--Optional:-->
<tes:FormaPago>01</tes:FormaPago>
<tes:LugarExpedicion>72000</tes:LugarExpedicion>
<!--Optional:-->
<tes:MetodoPago>PUE</tes:MetodoPago>
<!--Optional:-->
<tes:Moneda>MXN</tes:Moneda>
<!--Optional:-->
<!--Optional:-->
<!--Optional:-->
<tes:Referencia>1234</tes:Referencia>
<!--Optional:-->
<tes:SubTotal>0.11</tes:SubTotal>
<!--Optional:-->
<tes:Total>0.11</tes:Total>
</tem:ticket>
</tem:GenerarTicket>
</soapenv:Body>
</soapenv:Envelope>
Then I can submit the request and it works as expected. If like to try this with Postman so I can write the PHP code.
I am sending a POST to https://app.foliosdigitalespac.com/CR33Test/ConexionRemota.svc?function_name=GenerarTicket with the Content-Type header set to text/xml and the above XML as a raw XML body. When I click submit I get the following error.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode>
<faultstring xml:lang="es-MX">The message with Action 'GenerarTicket' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>
Obviously I am not doing something well but cant figure what it is. I was told by the WDSL developer than I can send a POST with the correct information and get the response. Any help please?
I figured out what was going on. The correct URL is https://app.foliosdigitalespac.com/CR33Test/ConexionRemota.svc.
Then the SOAPAction header must be set to the correct Action. According to the documentation the Action is http://tempuri.org/IConexionRemota/GenerarTicket. I was using as the Action only GenerarTicket.
Since I wanted to use PHP the corresponding code is
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://app.foliosdigitalespac.com/CR33Test/ConexionRemota.svc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"<soapenv:Envelope\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n xmlns:tem=\"http://tempuri.org/\"\n xmlns:tes=\"http://schemas.datacontract.org/2004/07/TES.V33.CFDI.Negocios\">\n <soapenv:Header/>\n <soapenv:Body>\n <tem:GenerarTicket>\n <!--Optional:-->\n <tem:credenciales>\n <!--Optional:-->\n <tes:Cuenta>TES030201001</tes:Cuenta>\n <!--Optional:-->\n <tes:Password>TES030201001j+2020</tes:Password>\n <!--Optional:-->\n <tes:Usuario>TES030201001</tes:Usuario>\n </tem:credenciales>\n <!--Optional:-->\n <tem:ticket>\n <!--Optional:-->\n <tes:ClaveCFDI>FAC</tes:ClaveCFDI>\n <!--Optional:-->\n <tes:Conceptos>\n <!--Zero or more repetitions:-->\n <tes:ConceptoR>\n <!--Optional:-->\n <tes:Cantidad>2</tes:Cantidad>\n <!--Optional:-->\n <tes:ClaveProdServ>84111506</tes:ClaveProdServ>\n <!--Optional:-->\n <tes:ClaveUnidad>C81</tes:ClaveUnidad>\n <!--Optional:-->\n <!--Optional:-->\n <tes:Descripcion>Producto 1</tes:Descripcion>\n <!--Optional:-->\n <tes:Importe>0.09</tes:Importe>\n <!--Optional:-->\n <tes:NoIdentificacion>1234567890</tes:NoIdentificacion>\n <!--Optional:-->\n <tes:Unidad>ACT</tes:Unidad>\n <!--Optional:-->\n <tes:ValorUnitario>0.045</tes:ValorUnitario>\n <!--Optional:-->\n \n </tes:ConceptoR>\n <tes:ConceptoR>\n <!--Optional:-->\n <tes:Cantidad>5</tes:Cantidad>\n <!--Optional:-->\n <tes:ClaveProdServ>84111506</tes:ClaveProdServ>\n <!--Optional:-->\n <tes:ClaveUnidad>C81</tes:ClaveUnidad>\n <!--Optional:-->\n <tes:Descripcion>Producto 2</tes:Descripcion>\n <!--Optional:-->\n <tes:Importe>0.02</tes:Importe>\n <!--Optional:-->\n <tes:NoIdentificacion>001</tes:NoIdentificacion>\n <!--Optional:-->\n <tes:Unidad>ACT</tes:Unidad>\n <!--Optional:-->\n <tes:ValorUnitario>0.004</tes:ValorUnitario>\n <!--Optional:-->\n \n </tes:ConceptoR>\n </tes:Conceptos>\n <!--Optional:-->\n <tes:CondicionesDePago>Condiciones De Pago</tes:CondicionesDePago>\n <!--Optional:-->\n <!--Optional:-->\n <tes:Emisor>\n <!--Optional:-->\n <tes:Nombre>Nombre del Emisor</tes:Nombre>\n <!--Optional:-->\n <tes:RegimenFiscal>601</tes:RegimenFiscal>\n </tes:Emisor>\n <!--Optional:-->\n <tes:FormaPago>01</tes:FormaPago>\n <tes:LugarExpedicion>72000</tes:LugarExpedicion>\n <!--Optional:-->\n <tes:MetodoPago>PUE</tes:MetodoPago>\n <!--Optional:-->\n <tes:Moneda>MXN</tes:Moneda>\n <!--Optional:-->\n <!--Optional:-->\n <!--Optional:-->\n <tes:Referencia>1234</tes:Referencia>\n <!--Optional:-->\n <tes:SubTotal>0.11</tes:SubTotal>\n <!--Optional:-->\n <tes:Total>0.11</tes:Total>\n </tem:ticket>\n </tem:GenerarTicket>\n </soapenv:Body>\n</soapenv:Envelope>",
CURLOPT_HTTPHEADER => array(
"Content-Type: text/xml",
"SOAPAction: http://tempuri.org/IConexionRemota/GenerarTicket"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Related
I have request like:
<soapenv:Envelope xmlns:...>
<soapenv:Header/>
<soapenv:Body>
<con:getRequest>
<header requestId="?" usageMode="?">
<systemName>?</systemName>
<timestamp>?</timestamp>
<userName>?</userName>
</header>
<body>
<!--Optional:-->
<fetchProperty>
<!--1 or more repetitions:-->
<propertyName>?</propertyName>
</fetchProperty>
<id>?</id>
</body>
</con:getRequest>
</soapenv:Body>
</soapenv:Envelope>
How I can set params in ??
I set other values like below but I have no idea how to set those attributes.
self.__client.service.get(
header=dict(
systemName=system_name,
timestamp=datetime.date(2018, 04, 26),
userName=system_username),
body=dict(fetchProperty=dict(propertyName='ALL'), id=agreement_id)
)
Anyone can help with that?
Solved with:
self.__client.get(
header={
'requestId':'123',
'usageMode':'normal',
'systemName': system_name,
'timestamp': datetime.date(2018, 04, 26),
'userName': system_username
},
body=dict(fetchProperty=dict(propertyName='ALL'), id=agreement_id)
)
I don't know why if I put those parameters in dict() methot it didn't work
I am trying to view the data of a BI publisher report from SOAP UI.
I have used SAWSessionService to establish the connection and as a response I have got a sessionID .
I have again used XMLViewService -> executeXMLQuery to view the report .
I have used the sessionID that I got earlier , to create the envelope as follows:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v7="urn://oracle.bi.webservices/v7">
<soapenv:Header/>
<soapenv:Body>
<v7:executeXMLQuery>
<v7:report>
<v7:reportPath>absolute_report_path
</v7:reportPath>
<v7:reportXml></v7:reportXml>
</v7:report>
<v7:outputFormat></v7:outputFormat>
<v7:executionOptions>
<v7:async></v7:async>
<v7:maxRowsPerPage></v7:maxRowsPerPage>
<v7:refresh></v7:refresh>
<v7:presentationInfo></v7:presentationInfo>
<v7:type></v7:type>
</v7:executionOptions>
<v7:reportParams>
<!--Zero or more repetitions:-->
<v7:filterExpressions></v7:filterExpressions>
<!--Zero or more repetitions:-->
<v7:variables>
<v7:name></v7:name>
<v7:value></v7:value>
</v7:variables>
<!--Zero or more repetitions:-->
<v7:nameValues>
<v7:name></v7:name>
<v7:value></v7:value>
</v7:nameValues>
<!--Zero or more repetitions:-->
<v7:templateInfos>
<v7:templateForEach></v7:templateForEach>
<v7:templateIterator></v7:templateIterator>
<!--Zero or more repetitions:-->
<v7:instance>
<v7:instanceName></v7:instanceName>
<!--Zero or more repetitions:-->
<v7:nameValues>
<v7:name></v7:name>
<v7:value></v7:value>
</v7:nameValues>
</v7:instance>
</v7:templateInfos>
<!--Optional:-->
<v7:viewName></v7:viewName>
</v7:reportParams>
<v7:sessionID>session_id_Earlier_Generated</v7:sessionID>
</v7:executeXMLQuery>
</soapenv:Body>
</soapenv:Envelope>
But I am getting the response as Path not found .
I have given public permissions to the report .
Can someone please help ?
I feel I am doing something wrong .
Your absolute path needs to be based on the directory structure below your Shared Folders. For spaces in names, a + symbol has always worked for us. An easy way to find your absolute report path is to find the URL that you'd go to if you just clicked on the report to run it from the interactive menu, and then take the stuff after the xmlpserver:
For example:
http://yourdomainhere:9704/xmlpserver/FolderRepresentingCompanyNameUnderSharedFolders/ManufacturingFolder/Production+Stats.xdo
In this case, your absolute path is: /FolderRepresentingCompanyNameUnderSharedFolders/ManufacturingFolder/Production+Stats.xdo
I am trying to consume a WS-Security protected webservice but I am facing some problems. It is a CMDBuild webservice. I have read the CMDBuild Webservices Manual, but I had no success consuming it yet.
I used two ways to try to consume the webservices: SoapUI and Java using Apache CXF. I will describe what I have done to try to consume the webservice with both methods.
First of all, I installed the CMDB application successfully and I can access the WSDL normally. If you need to take a look into WSDL, you can see it here. I know that I have to send a username token, but what I don't know is where I have to put the username token and how I do that.
All methods provided in the webservice can be used upon authentication
in the CMDBuild system. The authentication is performed upon the WSS
Username Token profile 1.0 specification with digest password.
Other question is how I can obtain this username token and the digest password. What I have is the application username and password which I use to access the application GUI.
SoapUI
When I try to consume any method of webservice using SoapUI, the response is always the same:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Sender</soap:Value>
<soap:Subcode>
<soap:Value xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">ns1:InvalidSecurity</soap:Value>
</soap:Subcode>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">An error was discovered processing the <wsse:Security> header</soap:Text>
</soap:Reason>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Here, the XML request (generated by SoapUI):
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://soap.services.cmdbuild.org">
<soap:Header/>
<soap:Body>
<soap1:getCardList>
<!--Optional:-->
<soap1:className></soap1:className>
<!--Zero or more repetitions:-->
<soap1:attributeList>
<!--Optional:-->
<soap1:code></soap1:code>
<!--Optional:-->
<soap1:name></soap1:name>
<!--Optional:-->
<soap1:value></soap1:value>
</soap1:attributeList>
<!--Optional:-->
<soap1:queryType>
<!--Optional:-->
<soap1:filter>
<!--Optional:-->
<soap1:name></soap1:name>
<!--Optional:-->
<soap1:operator>?</soap1:operator>
<!--Zero or more repetitions:-->
<soap1:value></soap1:value>
</soap1:filter>
<!--Optional:-->
<soap1:filterOperator>
<!--Optional:-->
<soap1:operator></soap1:operator>
<!--Zero or more repetitions:-->
<soap1:subquery/>
</soap1:filterOperator>
</soap1:queryType>
<!--Zero or more repetitions:-->
<soap1:orderType>
<!--Optional:-->
<soap1:columnName></soap1:columnName>
<!--Optional:-->
<soap1:type></soap1:type>
</soap1:orderType>
<!--Optional:-->
<soap1:limit></soap1:limit>
<!--Optional:-->
<soap1:offset></soap1:offset>
<!--Optional:-->
<soap1:fullTextQuery></soap1:fullTextQuery>
</soap1:getCardList>
</soap:Body>
</soap:Envelope>
Apache CXF
Using Java, I tried with Apache CXF and I generated the classes automatically (wsdl2java). After that, I code a little bit:
public class Main {
public static void main(String[] args) throws MalformedURLException {
Map<String, Object> inProps = new HashMap<String, Object>();
inProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
inProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
Proxy315Service srv = new Proxy315Service(new URL("http://example.com.br:8080/cmdbuild/services/soap/Webservices?wsdl"));
Webservices services = srv.getProxy315Port();
EndpointImpl jaxWsEndpoint = (EndpointImpl) EndpointImpl.publish("http://example.com.br:8080/cmdbuild/services/soap/Webservices", services);
Endpoint cxfEndpoint = jaxWsEndpoint.getServer().getEndpoint();
WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps);
cxfEndpoint.getInInterceptors().add(wssIn);
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, "gchaves");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
MenuSchema menu = services.getMenuSchema();
System.out.println(menu.getDescription());
}
}
Output:
Exception in thread "main" javax.xml.ws.WebServiceException: Could not find service named {http://proxy.sun.com/}Proxy315Service in wsdl http://example.com.br:8080/cmdbuild/services/soap/Webservices?wsdl
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:161)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:101)
at javax.xml.ws.Service.<init>(Unknown Source)
at com.sun.proxy.Proxy315Service.<init>(Proxy315Service.java:40)
at com.example.main.Main.main(Main.java:26)
Here is example that works for me:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://soap.services.cmdbuild.org">
<soap:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-2">
<wsse:Username>admin</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">admin</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<soap1:getCardList>
<!--Optional:-->
<soap1:className>Monitor</soap1:className>
<!--Zero or more repetitions:-->
<soap1:attributeList>
<!--Optional:-->
<!--Optional:-->
</soap1:attributeList>
<!--Optional:-->
<soap1:queryType>
<!--Optional:-->
<soap1:filter>
<!--Optional:-->
<soap1:name>Brand</soap1:name>
<!--Optional:-->
<soap1:operator>EQUALS</soap1:operator>
<!--Zero or more repetitions:-->
<soap1:value>HP</soap1:value>
</soap1:filter>
<!--Optional:-->
</soap1:queryType>
<!--Zero or more repetitions:-->
<soap1:orderType>
<!--Optional:-->
<soap1:columnName>Code</soap1:columnName>
<!--Optional:-->
<soap1:type>ASC</soap1:type>
</soap1:orderType>
<!--Optional:-->
<soap1:limit>0</soap1:limit>
<!--Optional:-->
<soap1:offset>0</soap1:offset>
<!--Optional:-->
<soap1:fullTextQuery>*</soap1:fullTextQuery>
</soap1:getCardList>
</soap:Body>
</soap:Envelope>
Although it is too late, this answer may help others.
See this link that explains how to use soapUI to consume ws-security enabled web services. You should just double click on the project (In soapUI) and configure outgoing wss. And in soap message (xml part) you should add wss header as it is described in the above link.
I am trying to retrieve TFS workitems using ClientService.asmx using JavaScript and I am able to access the webservice, however when using the SOAP it gives me following error "TF51612: The query does not contain any groups or expressions.
Parameter name: queryXml"
Below is the code that I am using to access the Workitems:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<RequestHeader xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03">
<Id></Id>
</RequestHeader>
</soap:Header>
<soap:Body>
<QueryWorkitems xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03">
<psQuery>
<queryXml>
<Wiql>SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State] FROM WorkItems WHERE [System.TeamProject] = #project AND [System.WorkItemType] <> '' AND [System.State] <> '' ORDER BY [System.Id] </Wiql>
</queryXml>
</psQuery>
</QueryWorkitems>
</soap:Body>
</soap:Envelope>
Please let me know what am I doing wrong.
Thanks
Your header SOAP must contais informations about your credential, because your query header's is empty so you are not authenticated
Add this with Soap Extension in your Web service, register in config file
After much pain I figured out how to do a proper request to this service. Here is my full request. Forgive me for the formatiing. I am apparently too dumb to figure out how to do a proper list.
Couple of notes...
*the RequestHeader Id field has to be in the format uuid:GUID
*The psQuery element is not actually in Wiql as other web sources have hinted. (Which is you are receiving the error)
*The FieldType for numeric fields is 288
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03">
<soapenv:Header>
<ns:RequestHeader>
<!--Optional:-->
<ns:Id>uuid:262c6910-8394-11e3-baa7-0800200c9a67</ns:Id>
</ns:RequestHeader>
</soapenv:Header>
<soapenv:Body>
<ns:QueryWorkitems>
<!--Optional:-->
<ns:psQuery>
<Group GroupOperator="And">
<Expression Column="System.TeamProject" FieldType="16" Operator="equals"><String>ProjectName</String></Expression>
<Expression Column="System.AssignedTo" FieldType="16" Operator="equals"><String>Daniel West</String></Expression>
<Expression Column="System.WorkItemType" FieldType="16" Operator="equals"><String>Anomaly</String></Expression>
<Expression Column="System.State" FieldType="16" Operator="equals"><String>Validate</String></Expression>
</Group>
</ns:psQuery>
<ns:sort>
<!--Zero or more repetitions:-->
<ns:QuerySortOrderEntry>
<!--Optional:-->
<ns:ColumnName>System.AssignedTo</ns:ColumnName>
<ns:Ascending>1</ns:Ascending>
</ns:QuerySortOrderEntry>
</ns:sort>
<ns:useMaster>1</ns:useMaster>
</ns:QueryWorkitems>
</soapenv:Body>
</soapenv:Envelope>
I am trying to create document in SharePoint repository using CMIS wsdl. but getting some error. I am using soapui to call the service.
Here's part of the xml that gets created:
Request : <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/cmis/messaging/200908/" xmlns:ns1="http://docs.oasis-open.org/ns/cmis/core/200908/">
<soapenv:Header/>
<soapenv:Body>
<ns:createDocument>
<!--Optional:-->
<ns:repositoryId>64bec929-945e-46f1-9c74-d0ab24803283</ns:repositoryId>
<!--Optional:-->
<ns:properties>
<propertyString propertyDefinitionId="cmis:name" localName="FileLeafRef" displayName="Name" queryName="cmis:name">
<value>test.txt</value>
</propertyString>
<propertyId propertyDefinitionId="cmis:objectId" localName="cmis:objectId" displayName="cmis:objectId" queryName="cmis:objectId">
<value>123123</value>
</propertyId>
<propertyId propertyDefinitionId="cmis:baseTypeId" localName="cmis:baseTypeId" displayName="cmis:baseTypeId" queryName="cmis:baseTypeId">
<value>cmis:document</value>
</propertyId>
<propertyId propertyDefinitionId="cmis:objectTypeId" localName="cmis:objectTypeId" displayName="cmis:objectTypeId" queryName="cmis:objectTypeId">
<value>cmis:document</value>
</propertyId>
<propertyBoolean propertyDefinitionId="cmis:isImmutable" localName="cmis:isImmutable" displayName="cmis:isImmutable" queryName="cmis:isImmutable">
<value>true</value>
</propertyBoolean>
<propertyBoolean propertyDefinitionId="cmis:isLatestVersion" localName="cmis:isLatestVersion" displayName="cmis:isLatestVersion" queryName="cmis:isLatestVersion">
<value>true</value>
</propertyBoolean>
<propertyBoolean propertyDefinitionId="cmis:isMajorVersion" localName="cmis:isMajorVersion" displayName="cmis:isMajorVersion" queryName="cmis:isMajorVersion">
<value>true</value>
</propertyBoolean>
<propertyBoolean propertyDefinitionId="cmis:isLatestMajorVersion" localName="cmis:isLatestMajorVersion" displayName="cmis:isLatestMajorVersion" queryName="cmis:isLatestMajorVersion">
<value>true</value>
</propertyBoolean>
<propertyString propertyDefinitionId="cmis:versionLabel" localName="cmis:versionLabel" displayName="cmis:versionLabel" queryName="cmis:versionLabel">
<value>1.0</value>
</propertyString>
<propertyId propertyDefinitionId="cmis:versionSeriesId" localName="cmis:versionSeriesId" displayName="cmis:versionSeriesId" queryName="cmis:versionSeriesId">
<value>1</value>
</propertyId>
<propertyBoolean propertyDefinitionId="cmis:isVersionSeriesCheckedOut" localName="cmis:isVersionSeriesCheckedOut" displayName="cmis:isVersionSeriesCheckedOut" queryName="cmis:isVersionSeriesCheckedOut">
<value>true</value>
</propertyBoolean>
<propertyInteger propertyDefinitionId="cmis:contentStreamLength" localName="File_x0020_Size" displayName="File Size" queryName="cmis:contentStreamLength">
<value>19444</value>
</propertyInteger>
<propertyString propertyDefinitionId="cmis:contentStreamMimeType" localName="cmis:contentStreamMimeType" displayName="cmis:contentStreamMimeType" queryName="cmis:contentStreamMimeType">
<value>text/plain</value>
</propertyString>
<propertyString propertyDefinitionId="cmis:contentStreamFileName" localName="FileLeafRef" displayName="Name" queryName="cmis:contentStreamFileName">
<value>test.txt</value>
</propertyString>
</ns:properties>
<ns:folderId/>
<ns:contentStream>
<!--Optional:-->
<ns:length>19444</ns:length>
<!--Optional:-->
<ns:mimeType>text/plain</ns:mimeType>
<!--Optional:-->
<ns:filename>a1.txt</ns:filename>
<!--Optional:-->
<ns:stream>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</ns:stream>
</ns:contentStream>
<ns:versioningState>major</ns:versioningState>
<!--Zero or more repetitions:-->
<ns:policies/>
<ns:addACEs>
<!--Zero or more repetitions:-->
<ns1:permission>
<!--Optional:-->
<ns1:principal>
<!--Optional:-->
<ns1:principalId/>
</ns1:principal>
<!--Zero or more repetitions:-->
<ns1:permission>cmis:all</ns1:permission>
<ns1:direct>false</ns1:direct>
</ns1:permission>
</ns:addACEs>
<ns:removeACEs/>
<ns:extension/>
</ns:createDocument>
</soapenv:Body>
</soapenv:Envelope>
The response I get back is:
<faultcode>s:constraint</faultcode>
<faultstring>The operation violates a Repository- or Object-level constraint defined in the CMIS domain model.</faultstring>
<detail>
<cmisFault xmlns="http://docs.oasis-open.org/ns/cmis/messaging/200908/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<code>409</code>
<message>The operation violates a Repository- or Object-level constraint defined in the CMIS domain model.</message>
<type>constraint</type>
</cmisFault>
</detail>
</s:Fault>
Please help...
You are trying to set read-only properties such as cmis:object:id, cmis:versionSeriesId and others. Check the CMIS specification which properties are read-write properties.
you need to make sure that your parameter for versioning matches what you have enabled on SharePoint
Hi this is solution and it works!
Check Attachment in the image
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:createDocument xmlns="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:ns2="http://docs.oasis-open.org/ns/cmis/messaging/200908/">
<ns2:repositoryId>A1</ns2:repositoryId>
<ns2:properties>
<propertyId propertyDefinitionId="cmis:name">
<value>DADADAAAAAA.txt</value>
</propertyId>
<propertyId propertyDefinitionId="cmis:objectTypeId">
<value>DocumentTopLevel</value>
</propertyId>
</ns2:properties>
<ns2:folderId>100</ns2:folderId>
<ns2:contentStream>
<ns2:length>32768</ns2:length>
<ns2:mimeType>text/plain</ns2:mimeType>
<ns2:filename>data442.txt</ns2:filename>
<ns2:stream>
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1ee9605a-a27d-41e9-9c77-d2c1ad244768#example.jaxws.sun.com"/>
</ns2:stream>
</ns2:contentStream>
<ns2:versioningState>none</ns2:versioningState>
</ns2:createDocument>
</S:Body>
</S:Envelope>