Setting Flag for an Email in ActiveSync - activesync

Trying to set status Flag for an email using ActiveSync. Below is my request. I receive status 6. What's wrong with my request?
Request
<Sync xmlns="AirSync:" xmlns:email="Email:" xmlns:tasks="Tasks:" >
<Collections>
<Collection>
<SyncKey>648263900</SyncKey>
<CollectionId>11</CollectionId>
<GetChanges>0</GetChanges>
<Commands>
<Change>
<ServerId>11:2</ServerId>
<ApplicationData>
<email:Flag>
<email:Status>1</email:Status>
<email:FlagType>Follow Up</email:FlagType>
<tasks:StartDate>113-04-23T05:30:00.000Z</tasks:StartDate>
<tasks:UTCStartDate>113-04-23T05:30:00.000Z</tasks:UTCStartDate>
<tasks:DueDate>113-04-26T05:30:00.000Z</tasks:DueDate>
<tasks:UTCDueDate>113-04-26T05:30:00.000Z</tasks:UTCDueDate>
</email:Flag>
</ApplicationData>
</Change>
</Commands>
</Collection>
</Collections>
Response I receive
<?xml version="1.0"?>
<!DOCTYPE ActiveSync PUBLIC "-//MICROSOFT//DTD ActiveSync//EN" "http://www.microsoft.com/">
<Sync xmlns="AirSync:">
<Collections>
<Collection>
<SyncKey>648263900</SyncKey>
<CollectionId>11</CollectionId>
<Status>1</Status>
<Responses>
<Change>
<ServerId>11:2</ServerId>
<Status>6</Status>
</Change>
</Responses>
</Collection>
</Collections>
</Sync>

Change email:FlagType from Follow Up to for Follow Up.
And add </Sync> in the end.
Try:
<?xml version="1.0" encoding="utf-8"?>
<Sync xmlns="AirSync:" xmlns:email="Email:" xmlns:tasks="Tasks:" >
<Collections>
<Collection>
<SyncKey>648263900</SyncKey>
<CollectionId>11</CollectionId>
<GetChanges>0</GetChanges>
<Commands>
<Change>
<ServerId>11:2</ServerId>
<ApplicationData>
<email:Flag>
<email:Status>1</email:Status>
<email:FlagType>for Follow Up</email:FlagType>
<tasks:StartDate>113-04-23T05:30:00.000Z</tasks:StartDate>
<tasks:UTCStartDate>113-04-23T05:30:00.000Z</tasks:UTCStartDate>
<tasks:DueDate>113-04-26T05:30:00.000Z</tasks:DueDate>
<tasks:UTCDueDate>113-04-26T05:30:00.000Z</tasks:UTCDueDate>
</email:Flag>
</ApplicationData>
</Change>
</Commands>
</Collection>
</Collections>
</Sync>
See more: MS-ASEMAIL

Related

Hazelcast + Spring(xml config) + hz map store error

Using hazelcast 3.8.2 (hazelcast-all jar) + IMap+ mapstore + Spring 4.3.8 (xml config). In Spring xml config, 'hz:map-store' throws an error saying:
17:49:40.519 ERROR [main] org.springframework.test.context.TestContextManager – Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener#1868ed54] to prepare test instance [com.twc.ctg.ecp.service.dataaccess.maps.EntitlementMapTest#1b9ea3e3] org.xml.sax.SAXParseException: cvc-complex-type.2.1: Element 'hz:map' must have no character or element information item [children], because the type's content type is empty.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) ~[?:1.8.0_101]
What am I doing wrong?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hz="http://www.hazelcast.com/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.hazelcast.com/schema/spring
http://www.hazelcast.com/schema/spring/hazelcast-spring.xsd">
<hz:hazelcast id="hzInstance1">
<hz:config>
...
</hz:config>
</hz:hazelcast>
<hz:client id="hzInstance1Client">
...
</hz:client>
<hz:map id="entitlementCache" instance-ref="hzInstance1" name="entitlement">
<hz:map-store enabled="true" implementation="linearEntitlementMapStore"
write-delay-seconds="30000"/>
</hz:map>
<bean id="linearEntitlementMapStore" class="com.twc.ctg.ecp.service.dataaccess.maps.LinearEntitlementMapStore" />
</beans>
You need to configure MapStore in <hz:config> section.
Correct config should look like this
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hz="http://www.hazelcast.com/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.hazelcast.com/schema/spring
http://www.hazelcast.com/schema/spring/hazelcast-spring.xsd">
<hz:hazelcast id="hzInstance1">
<hz:config>
<hz:map name="entitlement">
<hz:map-store enabled="true" implementation="linearEntitlementMapStore"
write-delay-seconds="30000"/>
<!-- ... -->
</hz:map>
</hz:config>
</hz:hazelcast>
<hz:client id="hzInstance1Client">
<!--... -->
</hz:client>
<bean id="linearEntitlementMapStore" class="com.twc.ctg.ecp.service.dataaccess.maps.LinearEntitlementMapStore"/>

NetSuite API Insert Phone Call

I've successfully created a phone call record in netsuite and related it to a company record. However, I haven't been able to relate a phone call to a contact record. Where am I going wrong?
Error
{
"message": "Invalid contact reference key 43780 for company <NULL>.",
"code": "INVALID_KEY_OR_REF"
}
Note: Internal ID 4370 is a contact in netsuite
Envelope with variables
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<applicationInfo xmlns="urn:messages_2015_2.platform.webservices.netsuite.com">
<applicationId>_appId_</applicationId>
</applicationInfo>
<preferences xmlns="urn:messages_2015_2.platform.webservices.netsuite.com">
<warningAsError>false</warningAsError>
</preferences>
</soap:Header>
<soap:Body>
<update xmlns="urn:messages_2015_2.platform.webservices.netsuite.com">
<record internalId="_callId_" xmlns:q1="urn:scheduling_2015_2.activities.webservices.netsuite.com" xsi:type="q1:PhoneCall">
<q1:message>_description_</q1:message>
<q1:title>_name_</q1:title>
<q1:assigned internalId="_user_" type="contact"/>
<q1:contact internalId="_customer_" type="contact"/>
<q1:phone>_number_</q1:phone>
<q1:startDate>_startDate_</q1:startDate>
<q1:endDate>_endDate_</q1:endDate>
<q1:timedEvent>true</q1:timedEvent>
</record>
</update>
</soap:Body>
</soap:Envelope>

OC 2.0 Fedex shipping method not working

We tried to Fedex shipping method in our opencart website.
It Display the "Error" text.
ERRORERRORcrs691The PurposeOfShipmentType is null, empty or invalid.
The PurposeOfShipmentType is null, empty or invalid.crs1000
Use this xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://fedex.com/ws/rate/v13">
<SOAP-ENV:Body>
<RateRequest>
<WebAuthenticationDetail>
<UserCredential>
<Key>XXXXX</Key>
<Password>XXXXX</Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber>XXXXX</AccountNumber>
<MeterNumber>XXXXX</MeterNumber>
</ClientDetail>
<TransactionDetail>
<CustomerTransactionId>MY-RATE-REQUEST</CustomerTransactionId>
</TransactionDetail>
<Version>
<ServiceId>crs</ServiceId>
<Major>13</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<ReturnTransitAndCommit>true</ReturnTransitAndCommit>
<RequestedShipment>
<ShipTimestamp>2012-10-09T14:28:07.9489435+05:30</ShipTimestamp>
<DropoffType>REGULAR_PICKUP</DropoffType>
<PackagingType>YOUR_PACKAGING</PackagingType>
<Shipper>
<Address>
<StreetLines>Sardarnagar Main Road, Rajkot</StreetLines>
<City>Rajkot</City>
<StateOrProvinceCode>GJ</StateOrProvinceCode>
<PostalCode>360001</PostalCode>
<CountryCode>IN</CountryCode>
</Address>
</Shipper>
<Recipient>
<Address>
<StreetLines>Radhekrishna App. Main Road , Rajkot</StreetLines>
<City>Bhuj</City>
<StateOrProvinceCode>GJ</StateOrProvinceCode>
<PostalCode>370001</PostalCode>
<CountryCode>IN</CountryCode>
</Address>
</Recipient>
<ShippingChargesPayment>
<PaymentType>SENDER</PaymentType>
<Payor>
<ResponsibleParty>
<AccountNumber>XXXXX</AccountNumber>
</ResponsibleParty>
</Payor>
</ShippingChargesPayment>
<CustomsClearanceDetail>
<DutiesPayment>
<PaymentType>RECIPIENT</PaymentType>
</DutiesPayment>
<DocumentContent>NON_DOCUMENTS</DocumentContent>
<CustomsValue>
<Currency>INR</Currency>
<Amount>299.000000</Amount>
</CustomsValue>
<CommercialInvoice>
<Purpose>NOT_SOLD</Purpose>
</CommercialInvoice>
</CustomsClearanceDetail>
<RateRequestTypes>ACCOUNT</RateRequestTypes>
<RateRequestTypes>LIST</RateRequestTypes>
<PackageCount>1</PackageCount>
<RequestedPackageLineItems>
<SequenceNumber>1</SequenceNumber>
<GroupPackageCount>1</GroupPackageCount>
<Weight>
<Units>KG</Units>
<Value>1</Value>
</Weight>
</RequestedPackageLineItems>
</RequestedShipment>
</RateRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Active Sync Client Sync Message, status code 4 - ParseSyncKey - AirSyncPermanentException

I'm currently writing an active sync client and I've successfully managed to do a folder sync. I'm now attempting to sync the "Notes" folder (using the sync command) and it's giving me an error code 4, which Microsoft describes as "Protocol Error" -- I don't see anything wrong in the protocol that I'm sending, here is the sections from my log:
Folder sync RequestBody :
<?xml version="1.0" encoding="utf-8" ?>
<FolderSync xmlns="FolderHierarchy:">
<SyncKey>0</SyncKey>
</FolderSync>
FolderSync ResponseBody:
<?xml version="1.0" encoding="utf-8" ?>
<FolderSync xmlns="FolderHierarchy:">
<Status>1</Status>
<SyncKey>1</SyncKey>
<Changes>
<Count>12</Count>
<Add>
<ServerId>1</ServerId>
<ParentId>0</ParentId>
<DisplayName>Calendar</DisplayName>
<Type>8</Type>
</Add>
<Add>
<ServerId>2</ServerId>
<ParentId>0</ParentId>
<DisplayName>Contacts</DisplayName>
<Type>9</Type>
</Add>
<Add>
<ServerId>3</ServerId>
<ParentId>0</ParentId>
<DisplayName>Deleted Items</DisplayName>
<Type>4</Type>
</Add>
<Add>
<ServerId>4</ServerId>
<ParentId>0</ParentId>
<DisplayName>Drafts</DisplayName>
<Type>3</Type>
</Add>
<Add>
<ServerId>5</ServerId>
<ParentId>0</ParentId>
<DisplayName>Inbox</DisplayName>
<Type>2</Type>
</Add>
<Add>
<ServerId>6</ServerId>
<ParentId>0</ParentId>
<DisplayName>Journal</DisplayName>
<Type>11</Type>
</Add>
<Add>
<ServerId>7</ServerId>
<ParentId>0</ParentId>
<DisplayName>Junk E-Mail</DisplayName>
<Type>12</Type>
</Add>
<Add>
<ServerId>8</ServerId>
<ParentId>0</ParentId>
<DisplayName>Notes</DisplayName>
<Type>10</Type>
</Add>
<Add>
<ServerId>9</ServerId>
<ParentId>0</ParentId>
<DisplayName>Outbox</DisplayName>
<Type>6</Type>
</Add>
<Add>
<ServerId>10</ServerId>
<ParentId>0</ParentId>
<DisplayName>Sent Items</DisplayName>
<Type>5</Type>
</Add>
<Add>
<ServerId>11</ServerId>
<ParentId>0</ParentId>
<DisplayName>Tasks</DisplayName>
<Type>7</Type>
</Add>
<Add>
<ServerId>RI</ServerId>
<ParentId>0</ParentId>
<DisplayName>RecipientInfo</DisplayName>
<Type>19</Type>
</Add>
</Changes>
</FolderSync>
My Sync RequestBody :
<?xml version="1.0" encoding="utf-8" ?>
<Sync xmlns="AirSync:">
<Collections>
<Collection>
<SyncKey>0</SyncKey>
<CollectionId>8</CollectionId>
<DeletesAsMoves>1</DeletesAsMoves>
<GetChanges/>
</Collection>
</Collections>
</Sync>
Lists this exception:
SyncCommand_OnExecute_Exception :
Microsoft.Exchange.AirSync.AirSyncPermanentException
at Microsoft.Exchange.AirSync.SyncCommand.ParseSyncKey(SyncCollection collection)
at Microsoft.Exchange.AirSync.SyncCommand.SyncTheCollection(SyncCollection collection, Boolean createSubscription, Boolean tryNullSync)
at Microsoft.Exchange.AirSync.SyncCommand.OnExecute()
And provides the following ResponseBody :
<?xml version="1.0" encoding="utf-8" ?>
<Sync xmlns="AirSync:">
<Status>4</Status>
</Sync>
Any ideas why it is failing there? This is the first sync of the folder, so the SyncKey SHOULD be 0...
From http://msdn.microsoft.com/en-us/library/gg675447(v=exchg.80).aspx :
A Status element (section 2.2.3.162.16) value of 4 is returned if the GetChanges element is present and empty or set to 1 (TRUE) when the SyncKey element value is 0 (zero). No error is returned if the GetChanges element is absent or set to 0 (FALSE) when the SyncKey value is 0 (zero).
You have present and empty in your xml.
You only may set GetChanges to 1 or live it empty (which is by default = 1) in any consequential sync request, not in initial sync request.

Post soap envelope from bash script

How would I post the following soap envelope via a bash script.
In PHP I would post using cURL but don't know how to translate into bash?
<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<n:Request xmlns:n="http://www.****.com/iprs/soap" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" env:mustUnderstand="true">UserMod</n:Request>
</env:Header>
<env:Body>
<n:RequestUserMod xmlns:n="http://www.****.com/iprs/soap">
<n:UserID>****</n:UserID>
<n:UserData >
<n:SystemName>****</n:SystemName>
<n:AdminState>enabled</n:AdminState>
<n:CategoryTypeID>****</n:CategoryTypeID>
<n:Permissions>****</n:Permissions>
<n:BillingProgID>****</n:BillingProgID>
<n:DefaultGroupID>****</n:DefaultGroupID>
<n:PrimarySiteID>****</n:PrimarySiteID>
<n:SecondarySiteID>****</n:SecondarySiteID>
<n:ContactInfo></n:ContactInfo>
<n:Password>****</n:Password>
</n:UserData>
</n:RequestUserMod>
</env:Body>
</env:Envelope>
If possible I would also like to detect the response, which should be:
HTTP/1.1 200 OK
Content-Type:application/soap+xml; charset="utf-8"
Content-Length:509
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header>
<n:Response xmlns:n="http://www.*****.com/iprs/soap" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" env:mustUnderstand="true">UserMod</n:Response>
</env:Header>
<env:Body>
<n:ResponseUserMod xmlns:n="http://www.*****.com/iprs/soap">
<n:StatusReport>
<n:Code>ok</n:Code>
<n:SubCode>0</n:SubCode>
</n:StatusReport>
</n:ResponseUserMod>
</env:Body>
</env:Envelope>
Perhaps like this?
curl --data - --request "POST" "http://www.somesite.com" <<EOF
<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<n:Request xmlns:n="http://www.****.com/iprs/soap" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" env:mustUnderstand="true">UserMod</n:Request>
</env:Header>
<env:Body>
<n:RequestUserMod xmlns:n="http://www.****.com/iprs/soap">
<n:UserID>****</n:UserID>
<n:UserData >
<n:SystemName>****</n:SystemName>
<n:AdminState>enabled</n:AdminState>
<n:CategoryTypeID>****</n:CategoryTypeID>
<n:Permissions>****</n:Permissions>
<n:BillingProgID>****</n:BillingProgID>
<n:DefaultGroupID>****</n:DefaultGroupID>
<n:PrimarySiteID>****</n:PrimarySiteID>
<n:SecondarySiteID>****</n:SecondarySiteID>
<n:ContactInfo></n:ContactInfo>
<n:Password>****</n:Password>
</n:UserData>
</n:RequestUserMod>
</env:Body>
</env:Envelope>
EOF
to post:
cat file | curl ...
but to retrieve the result, and act according to it, embed it all in a expect script.

Resources