XQuery Transformation Mapping Error: {err}FORG0005: expected exactly one item, got 0 items - soap

I'm having trouble doing XQuery mapping. The error reads as follows:
Error at analyzing XML: {err}FORG0005: expected exactly one item, got 0 items.
This is the response document I recieve:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header xmlns:cgi="http://tempuri.org/Servicios/CGI"/>
<soap:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<GetConsumosResponse xmlns="http://tempuri.org/Servicios/CGI">
<GetConsumosResult>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Consumos diffgr:id="Consumos1" msdata:rowOrder="0">
...
</Consumos>
...
</NewDataSet>
</diffgr:diffgram>
</GetConsumosResult>
</GetConsumosResponse>
</soap:Body>
</soapenv:Envelope>
In my OSB console I have the following binding...
Replace [ entire node ] of [ . ]
in [ getConsumosResponse ] with [ XQuery Resource... ]
XQuery resource: OSBSettlementProxy/XQuery/NGCombustibleXQResponse
Variable names and bindings:
newDataSet1: $getConsumosResponse/GetConsumosResponse/GetConsumosResult/diffgr:diffgram/NewDataSet
I already defined the diffgr in my namespaces, so I know that is not the problem...

It looks like GetConsumosResponse and GetConsumosResult are in the default namespace http://tempuri.org/Servicios/CGI. However, it looks like your path expression doesn't use this namespace. You might try adding a new namespace definition "cgi"="http://tempuri.org/Servicios/CGI" and then change your path to this:
$getConsumosResponse/cgi:GetConsumosResponse/cgi:GetConsumosResult/diffgr:diffgram/NewDataSet

Related

Update fieldPermissions with metadata api of Salesforce

I try to update the permissions on a field created from the API so that it is visible and usable.
so I do this via the salesforce metadata API.
responses = client.call(:update_metadata, message_tag: :updateMetadata, message: {metadata: { fullName: 'Admin', fieldPermissions: {field: "Contact.custom_attribute1_soap__c", editable: true, readable: true}}, :attributes! => {metadata: {"xsi:type" => "Profile"}}})
client is an instance of the gem Savon.
which gives me this, and seems correct to me !
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://soap.sforce.com/2006/04/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Header>
<tns:SessionHeader>
<tns:sessionId>s3ss10n1d</tns:sessionId>
</tns:SessionHeader>
</env:Header>
<env:Body>
<tns:updateMetadata>
<tns:metadata xsi:type="Profile">
<tns:fullName>Admin</tns:fullName>
<tns:fieldPermissions>
<tns:field>Contact.custom_attribute1_soap__c</tns:field>
<tns:editable>true</tns:editable>
<tns:readable>true</tns:readable>
</tns:fieldPermissions>
</tns:metadata>
</tns:updateMetadata>
</env:Body>
</env:Envelope>
however, salesforce sends me back a mistake.
After hours of searching the documentation I don't understand.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>Unable to determine type mapping for type Profile. Type is illegal here.</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
One of you could explain my mistake to me, or give me a method to modify the permissions on a custom field created via the API, please?
You're missing the attribute "xmlns": "http://soap.sforce.com/2006/04/metadata"
Try:
responses = client.call(
:update_metadata,
message_tag: :updateMetadata,
message: {
metadata: {fullName: 'Admin', fieldPermissions: {field: "Contact.custom_attribute1_soap__c", editable: true, readable: true}},
:attributes! => {metadata: {"xsi:type" => "Profile", "xmlns": "http://soap.sforce.com/2006/04/metadata"}}
}
)
In my case, the following schema worked:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://soap.sforce.com/2006/04/metadata">
<soapenv:Header>
<tns:SessionHeader>
<tns:sessionId>your_id</tns:sessionId>
</tns:SessionHeader>
</soapenv:Header>
<soapenv:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:updateMetadata>
<tns:metadata xsi:type="tns:Profile">
<tns:fullName>Admin</tns:fullName>
<tns:fieldPermissions>
<tns:field>CustomObject__c.CustomField__c</tns:field>
<tns:editable>true</tns:editable>
<tns:readable>true</tns:readable>
</tns:fieldPermissions>
</tns:metadata>
</tns:updateMetadata>
</soapenv:Body>
</soapenv:Envelope>

Server was unable to process request.,Object reference not set to an instance of an object. SOAP API

want to push data through soap API, code provided in API documentation is given below. i am getting error. error i am getting. let me know where i am wrong, thanks in advance.
url
<?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:Body>
<PushData xmlns="RBSS">
<RBSS>
<Lead_Response_DateTime>20-05-2016 10:25:16</Lead_Response_DateTime>
<Lead_Push_DateTime>20-05-2016 10:25:16</Lead_Push_DateTime>
<Lead_Recd_DataTime>20-05-2016 10:25:16</Lead_Recd_DataTime>
<FirstName>test</FirstName>
<Phone1>9876543215</Phone1>
<Phone2>9876543215</Phone2>
<Email>amrit#gmail.com</Email>
<DOB>20-05-2016</DOB>
<Age>26</Age>
<Child_DOB>20-05-2002</Child_DOB>
<Child_Age>4</Child_Age>
<Pincode>400052</Pincode>
<City_Name>Mumbai</City_Name>
<Address>2, Akshardham…..</Address>
<Annual_Income>1000000</Annual_Income>
<Annual_Income_Slab>10</Annual_Income_Slab>
<SMS_Keyword>0</SMS_Keyword>
<Short_Code></Short_Code>
<Circle_Operator></Circle_Operator>
<Sum_Assured></Sum_Assured>
<Premium_Pitched></Premium_Pitched>
<Company_Name>WRS</Company_Name>
<Website_Name>Bima Deals.com</Website_Name>
<UTN_Source>FaceBook</UTN_Source>
<Lead_Source></Lead_Source>
<Type_Of_Lead></Type_Of_Lead>
<Verification_Type></Verification_Type>
<Product_Name></Product_Name>
<Product_Category></Product_Category>
<No_of_Companies></No_of_Companies>
<Names_of_Companied></Names_of_Companied>
<SMS_Message_Sent></SMS_Message_Sent>
<Customer__Remarks></Customer__Remarks>
<FLAG></FLAG>
<Lead_Type>INCOMING_WEB</Lead_Type>
<Channel_Type>INTERNET</Channel_Type>
<Mode_Type>PREFIXED_APPOINTMENT</Mode_Type>
<Source_Type>BIMADEALS</Source_Type>
<Campaign_Type>APR_16</Campaign_Type>
<Opportunity_Id>123456</Opportunity_Id>
<PROSPECT_ID></PROSPECT_ID>
<Title>MR</Title>
<UID></UID>
<LastName>Lastname</LastName>
<Gender>Male</Gender>
<MaritalStatus></MaritalStatus>
<MobileNo>9865856325</MobileNo>
<AgeAtRetirement></AgeAtRetirement>
<VendorCSE_Name></VendorCSE_Name>
<TermOfPlan></TermOfPlan>
<Smoker_NonSmoker></Smoker_NonSmoker>
<VendorCode></VendorCode>
<MeetingDate></MeetingDate>
<MeetingTime></MeetingTime>
<City_ID>67</City_ID>
<ID>123</ID>
<CallcenterID></CallcenterID>
<ADDLInfo1></ADDLInfo1>
<ADDLInfo2></ADDLInfo2>
</RBSS>
</PushData>
</soap:Body>
</soap:Envelope>

Schema validation error when using Restriction in EWS FindItem request

I'm trying to find items in inbox with ItemClass = IPM.Note
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP2"></t:RequestServerVersion>
</soap:Header>
<soap:Body>
<FindItem Traversal="Shallow" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ItemShape>
<t:BaseShape xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">IdOnly</t:BaseShape>
<t:AdditionalProperties xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<t:FieldURI FieldURI="item:ItemClass"></t:FieldURI>
</t:AdditionalProperties>
</ItemShape>
<IndexedPageItemView MaxEntriesReturned="50" Offset="0" BasePoint="Beginning"></IndexedPageItemView>
<Restriction>
<IsEqualTo>
<FieldURI FieldURI="item:ItemClass"></FieldURI>
<FieldURIOrConstant>
<Constant Value="IPM.Note"></Constant>
</FieldURIOrConstant>
</IsEqualTo>
</Restriction>
<ParentFolderIds>
<t:DistinguishedFolderId Id="inbox" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"></t:DistinguishedFolderId>
</ParentFolderIds>
</FindItem>
</soap:Body>
</soap:Envelope>
Resulting in this SchemaValidationError
a:ErrorSchemaValidation: The request failed schema validation: The element 'Restriction' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages' has invalid child element 'IsEqualTo' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'. List of possible elements expected: 'SearchExpression' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'. [undefined] Error: a:ErrorSchemaValidation: The request failed schema validation: The element 'Restriction' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages' has invalid child element 'IsEqualTo' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'. List of possible elements expected: 'SearchExpression' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'.
To my understaning, SearchExpression is an abstract type that can be replaced with IsEqualTo, among other types.
What am I missing here?
Some of these elements are in the 'types' namespace so they need the t: prefix
<Restriction>
<t:IsEqualTo>
<t:FieldURI FieldURI="item:ItemClass"></t:FieldURI>
<t:FieldURIOrConstant>
<t:Constant Value="IPM.Note"></t:Constant>
</t:FieldURIOrConstant>
</t:IsEqualTo>
</Restriction>

Invalid Soap Call

Why doesn't this soap call work for this URL ?
http://services.aonaware.com/DictService/DictService.asmx?op=Define
<v:Envelope xmlns:i="http://www.w3.org/1999/XMLSchema-instance" xmlns:d="http://www.w3.org/1999/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<Define xmlns="http://tempuri.org/" id="o0" c:root="1">
<word i:type="d:string">Name</word>
</Define>
</v:Body>
</v:Envelope>
But this one does
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://services.aonaware.com/webservices/">
<soapenv:Header/>
<soapenv:Body>
<web:Define>
<!--Optional:-->
<web:word>Test</web:word>
</web:Define>
</soapenv:Body>
</soapenv:Envelope>
Because they are different: not only in content but also in namespace definition, to correct the first one you've to atleast use the correct namespace so use http://services.aonaware.com/webservices/ for your <Define> element as you do in the second one:
<v:Envelope xmlns:i="http://www.w3.org/1999/XMLSchema-instance" xmlns:d="http://www.w3.org/1999/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<Define xmlns="http://services.aonaware.com/webservices/" id="o0" c:root="1">
<word i:type="d:string">Name</word>
</Define>
</v:Body>
</v:Envelope>
Then make sure also that id an c:root are valid attributes in your xsd for <Definition> and i:type it's a correct one for <word>.
EDIT
I invoke http://services.aonaware.com/DictService/DictService.asmx with SOAPUI using my corrected request and it response correctly:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DefineResponse xmlns="http://services.aonaware.com/webservices/">
<DefineResult>
<Word>Name</Word>
<Definitions>
<Definition>
<Word>Name</Word>
<Dictionary>
<Id>gcide</Id>
<Name>The Collaborative International Dictionary of English v.0.44</Name>
</Dictionary>
<WordDefinition>Name \Name\ (n[=a]m), n. [AS. nama; akin to D. naam, OS. & OHG.
...
[1913 Webster]</WordDefinition>
</Definition>
<Definition>
<Word>Name</Word>
<Dictionary>
<Id>gcide</Id>
<Name>The Collaborative International Dictionary of English v.0.44</Name>
</Dictionary>
<WordDefinition>Name \Name\ (n[=a]m), v. t. [imp. & p. p. {Named} (n[=a]md); p.
...
</WordDefinition>
</Definition>
</Definitions>
</DefineResult>
</DefineResponse>
</soap:Body>
</soap:Envelope>
Hope this helps,

How to 'set' read-only calendar appointment properties (related to meetings)?

I'm recreating calendar meeting events in a sychronization tool (using CreateItem), basically preserving some properties for meetings and writing them back.
However, there are some properties that are read-only, and I see no way to preserve their state:
IsMeeting
IsCancelled
MeetingRequestWasSent
IsOnlineMeeting
Some of these boolean values are stored in property AppointmentState, but that is read-only too:
Name Bit Description
None 0x0000 No flags have been set. This is only used for an appointment that does not include attendees.
Meeting 0x0001 This appointment is a meeting.
Received 0x0002 This appointment has been received.
Canceled 0x0004 This appointment has been canceled.
Is IsMeeting maybe automatically set if I set other meeting-properties, like e.g. OptionalAttendees or RequiredAttendees? That would help with one of the four, if I knew which properties trigger the setting of IsMeeting.
(Yes, this is a follow-up to Meeting request properties not settable in EWS SOAP calls?).
You should be able to use MAPI Extended Properties:
Appointment state is
Named Prop Name: id: 0x8217=33303 = PidLidAppointmentStateFlags, dispidApptStateFlags
Named Prop Guid: {00062002-0000-0000-C000-000000000046} = PSETID_Appointment
So SOAP that should be something like
<t:ExtendedProperty>
<t:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33303" PropertyType="Integer" />
<t:Value>1</t:Value>
</t:ExtendedProperty>
(I use the managed API for that, and got that XML from the trace-log, hope that is something you can use)
[Edited by the OP] This is the complete call that does the job:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
<typ:MailboxCulture>en-US</typ:MailboxCulture>
<typ:TimeZoneContext>
<typ:TimeZoneDefinition Id="W. Europe Standard Time"/>
</typ:TimeZoneContext>
</soapenv:Header>
<soapenv:Body>
<mes:UpdateItem ConflictResolution="AutoResolve" SendMeetingInvitationsOrCancellations="SendOnlyToChanged">
<mes:ItemChanges>
<typ:ItemChange>
<typ:ItemId <t:ItemId Id="AAMkA[snip]xAAA=" ChangeKey="Dw[snip]Mar"/>
<typ:Updates>
<typ:SetItemField>
<typ:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33303" PropertyType="Integer"/>
<typ:CalendarItem>
<typ:ExtendedProperty>
<typ:ExtendedFieldURI DistinguishedPropertySetId="Appointment" PropertyId="33303" PropertyType="Integer"/>
<typ:Value>5</typ:Value>
</typ:ExtendedProperty>
</typ:CalendarItem>
</typ:SetItemField>
</typ:Updates>
</typ:ItemChange>
</mes:ItemChanges>
</mes:UpdateItem>
</soapenv:Body>
</soapenv:Envelope>
Strangely, the result says "Success", but reports a (one) conflict. I have no idea which one:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="225" MinorBuildNumber="19" Version="V2_48" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:UpdateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:UpdateItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:CalendarItem>
<t:ItemId Id="AAMk[snip]xAAA=" ChangeKey="DwA[snip]aMat"/>
</t:CalendarItem>
</m:Items>
<m:ConflictResults>
<t:Count>1</t:Count>
</m:ConflictResults>
</m:UpdateItemResponseMessage>
</m:ResponseMessages>
</m:UpdateItemResponse>
</s:Body>
</s:Envelope>