How to find an feature in WFS by filter? - leaflet

I try to find feature by id and layer id by WFS:
const cql_filter = "&cql_filter=(id=layer202103_geom.42)";
Request looks like:
service: WFS
version: 1.0.0
request: GetFeature
typeName: layer20_geom
outputFormat: json
cql_filter: (id=layer20_geom.42)
It returns me an error:
<?xml version="1.0" ?>
<ServiceExceptionReport
version="1.2.0"
xmlns="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
<ServiceException>
Could not parse CQL filter list.
Encountered "id =" at line 1, column 2.
Was expecting one of:
<NOT> ...
"include" ...
My full geojson looks:
{"type":"FeatureCollection","features":[{"type":"Feature","id":"layer2_geom.42","geometry":{"type":"Po...

Related

Quickbooks InvoiceAdd qbxml format issue

I must be missing out something in the format of my XML file for adding an invoice to Quickbooks Desktop Enterprise US version, my qbxml request is as follows;
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq>
<InvoiceAdd>
<CustomerRef>
<FullName>XXXXXXXXX</FullName>
</CustomerRef>
<ClassRef>
<FullName>XXXXXXX</FullName>
</ClassRef>
<ARAccountRef>
<FullName>XXXXXXXXXX</FullName>
</ARAccountRef>
<TemplateRef>
<FullName>Standard invoice</FullName>
</TemplateRef>
<TxnDate/>
<RefNumber>83434</RefNumber>
<BillAddress>
<Addr1>4xxxxxx</Addr1>
<City>xxxxxxxx</City>
<State>XX</State>
<PostalCode>0000</PostalCode>
</BillAddress>
<IsPending>1</IsPending>
<IsFinanceCharge>0</IsFinanceCharge>
<PONumber>12345</PONumber>
<TermsRef>
<FullName>Net 30</FullName>
</TermsRef>
<DueDate/>
<SalesRepRef/>
<FOB/>
<ShipDate/>
<ShipMethodRef/>
<ItemSalesTaxRef/>
<Memo/>
<CustomerMsgRef/>
<IsToBePrinted>0</IsToBePrinted>
<IsToBeEmailed>0</IsToBeEmailed>
<IsTaxIncluded>0</IsTaxIncluded>
<CustomerSalesTaxCodeRef/>
<Other/>
<ExchangeRate>1</ExchangeRate>
<SetCredit>
<CreditTxnID>1</CreditTxnID>
<AppliedAmount>0</AppliedAmount>
<Override>1</Override>
</SetCredit>
<InvoiceLineAdd>
<itemRef>
<FullName>S-check UT</FullName>
</itemRef>
<Desc>Interpreter</Desc>
<Quantity>1</Quantity>
<UnitOfMeasure/>
<Rate>10</Rate>
<RatePercent>100</RatePercent>
<PriceLevelRef/>
<ClassRef/>
<Amount>10</Amount>
<OptionForPriceRuleConflict>0</OptionForPriceRuleConflict>
<InventorySiteRef/>
<InventorySiteLocationRef/>
<SerialNumber/>
<LotNumber/>
<ServiceDate/>
<SalesTaxCodeRef/>
<OverrideItemAccountRef/>
<Other1/>
<Other2/>
<LinkToTxn>
<TxnID>0</TxnID>
<TxnLineID>0</TxnLineID>
</LinkToTxn>
<DataExt>
<OwnerID>3caa4f6f-fcb3-4767-99e6-0ba5dfd34e8f</OwnerID>
<DataExtName>Sample</DataExtName>
<DataExtValue>Sample</DataExtValue>
</DataExt>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
When i check this xml request using the qbxml validator i'm getting the following error message even though i have supplied all the required fields as outlined in the OSR tool;
Line: 53
LinePos: 20
Src Text: <itemRef>
Reason: Element content is invalid according to the DTD/Schema.
Expecting: ItemRef, Desc, Quantity, UnitOfMeasure, Rate, RatePercent, PriceLevelRef, ClassRef,
Amount, TaxAmount, OptionForPriceRuleCon....
I'm not sure about what's wrong with my xml file, when i run the quickbooks webconnector, the error message i get is;
Message: QuickBooks found an error when parsing the provided XML text stream.
I understand this is coming up because of the wrong format of my qbxml request which could be incorrect. Kindly assist
I have filtered your QBXML and removed all error producing QBXML tags
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq>
<InvoiceAdd>
<CustomerRef>
<FullName>XXXXXXXXX</FullName>
</CustomerRef>
<ClassRef>
<FullName>XXXXXXX</FullName>
</ClassRef>
<ARAccountRef>
<FullName>XXXXXXXXXX</FullName>
</ARAccountRef>
<TemplateRef>
<FullName>Standard invoice</FullName>
</TemplateRef>
<TxnDate/>
<RefNumber>83434</RefNumber>
<BillAddress>
<Addr1>4xxxxxx</Addr1>
<City>xxxxxxxx</City>
<State>XX</State>
<PostalCode>0000</PostalCode>
</BillAddress>
<IsPending>1</IsPending>
<IsFinanceCharge>0</IsFinanceCharge>
<PONumber>12345</PONumber>
<TermsRef>
<FullName>Net 30</FullName>
</TermsRef>
<DueDate/>
<SalesRepRef/>
<FOB/>
<ShipDate/>
<ShipMethodRef/>
<ItemSalesTaxRef/>
<Memo/>
<CustomerMsgRef/>
<IsToBePrinted>0</IsToBePrinted>
<IsToBeEmailed>0</IsToBeEmailed>
<IsTaxIncluded>0</IsTaxIncluded>
<CustomerSalesTaxCodeRef/>
<Other/>
<ExchangeRate>1</ExchangeRate>
<SetCredit>
<CreditTxnID>1</CreditTxnID>
<AppliedAmount>0</AppliedAmount>
<Override>1</Override>
</SetCredit>
<InvoiceLineAdd>
<Desc>Interpreter</Desc>
<Quantity>1</Quantity>
<UnitOfMeasure/>
<Rate>10</Rate>
<ClassRef/>
<Amount>10</Amount>
<InventorySiteRef/>
<InventorySiteLocationRef/>
<SerialNumber/>
<ServiceDate/>
<SalesTaxCodeRef/>
<OverrideItemAccountRef/>
<Other1/>
<Other2/>
<LinkToTxn>
<TxnID>0</TxnID>
<TxnLineID>0</TxnLineID>
</LinkToTxn>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>

How in Powershell see all XML Levels

I have a test xml and I want to get the value from this line ATTRIBUTE NAME="News- offers_OPT_EMAIL">F
so I can check for the value F or T
if I do below I can get the title but how do I get the above line value.
[xml]$xml = Get-Content testFile.xml
$xml
$xml.CUSTOMERS.CUSTOMER.NAME.TITLE
sample XML code
<?xml version="1.0" encoding="UTF-8"?>
<CUSTOMERS xml:lang="en">
<CUSTOMER CREATED_DATE="2018-01-01 05:18:53.0" GROUP_ID="" ID="95656565">
<NAME>
<TITLE>M</TITLE>
<FIRST_NAME>Joe</FIRST_NAME>
<LAST_NAME>Smith</LAST_NAME>
</NAME>
<GENDER/>
<DATE_OF_BIRTH/>
<ADDRESS>
<ADDRESS_LINE_1>1 White House</ADDRESS_LINE_1>
<ADDRESS_LINE_2>Old Ave</ADDRESS_LINE_2>
<ADDRESS_LINE_3/>
<TOWNCITY>LONDON</TOWNCITY>
<COUNTY/>
<POSTCODE>18659</POSTCODE>
<COUNTRY>France</COUNTRY>
</ADDRESS>
<ADDRESS>
<ADDRESS_LINE_1>175 avenue de la division Leclerc</ADDRESS_LINE_1>
<ADDRESS_LINE_2/>
<ADDRESS_LINE_3/>
<TOWNCITY>Antony</TOWNCITY>
<COUNTY/>
<POSTCODE>92160</POSTCODE>
<COUNTRY>France</COUNTRY>
</ADDRESS>
<CONTACT_DETAILS>
<TELEPHONE MARKETING_OPT_IN="F" TYPE="MOBILE">0123456789</TELEPHONE>
<EMAIL MARKETING_OPT_IN="F">johnsmith#gmail.com</EMAIL>
</CONTACT_DETAILS>
<ATTRIBUTE NAME="News- offers_OPT_EMAIL">F</ATTRIBUTE>
<NOTE>NA</NOTE>
</CUSTOMER>
You could use SelectSingleNode or SelectNodes with an XPath expression. There are several options to achieve what you want, depending on your intention, but this would be one way to do it:
# finde the nodes
$nodes = $xml.SelectNodes("//*[local-name()='ATTRIBUTE'][#NAME='News- offers_OPT_EMAIL']")
# get value
$nodes.InnerText
Or if the value of the attribute doesn't matter, simply do:
$xml.customers.customer.attribute.'#text'

How to Create and Associate a Category to a Contact using EWS Managed API 2.2

Is it possible to create a Category Item Object and Associate it with a Contact using the EWS Managed API?
You can assign a Category to any Object in a Mailbox using the Categories property https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.item.categories(v=exchg.80).aspx .
For a particular color/description to be show in Outlook or OWA the category you pass in must match an Item in the Master category list. You can read/modify the Master category list in a Mailbox using EWS eg https://social.msdn.microsoft.com/Forums/en-US/e5c5f072-0b5c-49ce-9db7-57f76f5e011e/edit-master-category-list-in-exchange-2010-via-ews?forum=exchangesvrdevelopment and https://social.msdn.microsoft.com/Forums/en-US/a3917500-2bbc-4def-98b4-696e49efed6f/adding-categories-to-a-users-master-category-list-in-exchange-2010-using-ews?forum=exchangesvrdevelopment
I came across this post while looking to update the master category list using EWS, but not the Managed API. In case anyone else is looking to do the same thing, here's the solution I came up with, which uses Python and requests:
import base64
import requests
from requests_ntlm import HttpNtlmAuth
# Create the XML request template for EWS
payload = r"""<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body>
<m:UpdateUserConfiguration>
<t:UserConfigurationName Name="CategoryList">
<t:DistinguishedFolderId Id="calendar">
<t:Mailbox>
<t:EmailAddress>your_email#your_domain.com</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
</t:DistinguishedFolderId>
</t:UserConfigurationName>
<t:XmlData>{}</t:XmlData>
</m:UpdateUserConfiguration>
</soap:Body>
</soap:Envelope>"""
# Create the categories XML
# Colors: https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxocfg/eb7cac90-6200-4ac3-8f3c-6c808c681c8b
xml_data = r"""<?xml version="1.0"?>
<categories default="First category" xmlns="CategoryList.xsd">
<category name="First category" color="1" />
<category name="Second category" color="2" />
</categories>"""
# Encode the payload and insert it into the XML request
xml = base64.b64encode(xml_data.encode())
payload = payload.replace('{}', str(xml).strip('b\''))
# Use requests with the NTLM authentication libary to submit the request
headers = {'content-type': 'text/xml'}
ews_url = 'https://mail.your-organizations-exchange-server.com/EWS/Exchange.asmx'
session = requests.Session()
session.auth = HttpNtlmAuth(exhange_username, exchange_password)
response = session.post(ews_url, data=payload, headers=headers)
print(response.text)

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

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

JAXB: default namespace declared in SOAP Envelop is not recognized in Body's xsi:type while unmarshalling

Below is a pseudo soap response coming from the server as below.
<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" xmlns="urn://tsys.com/xmlmessaging/T1">
<soap:Header>
<Header details/>
</soap:Header>
<soap:Body>
<inqMultiResponse>
<inqMultiResult status="000" statusMsg="passed" >
<inquireResult xsi:type="inqCustAddrResponseType" >
<addrInfo>
<addrType>Primary</addrType>
....
<x_4.0.0/>
</addrInfo>
</inquireResult>
<inquireResult xsi:type="inqGeneralAcctResponseType" status="000" statusMsg="passed">
<acctGeneralInfo>
<type>Z</type>
....
</stmtInfo>
<x_4.4.0/>
</acctGeneralInfo>
</inquireResult>
</inqMultiResult>
</inqMultiResponse>
</soap:Body>
While unmarshalling the xml using JAXB's Jaxb2Marshaller, i get the following exception in my EventHandler.
EVENT
SEVERITY: 1
MESSAGE: unrecognized type name: inqCustAddrResponseType. Did you mean {urn://tsys.com/xmlmessaging/T1}inqCustAddrResponseType?
LINKED EXCEPTION: null
LOCATOR
LINE NUMBER: -1
COLUMN NUMBER: -1
OFFSET: -1
OBJECT: null
NODE: [inquireResult: null]
URL: null
EVENT
SEVERITY: 2
MESSAGE: Unable to create an instance of com.tsys.xmlmessaging.t1.TSYSInquiryResponseType
LINKED EXCEPTION: java.lang.InstantiationException
LOCATOR
LINE NUMBER: -1
COLUMN NUMBER: -1
OFFSET: -1
OBJECT: null
NODE: [inquireResult: null]
URL: null
Below is my spring configuration.
<bean id="tsysTransactionMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="validationEventHandler" ref="validationEventHandler" />
<property name="contextPaths">
<list>
<value>com.tsys.xmlmessaging.t1</value>
</list>
</property>
</bean>
Request you to pls help me unmarshall the xml.
I have gone through various suggestions like
JAXB xsi:type subclass unmarshalling not working
and Blaise D blogs, but none of them talk of using it with Jaxb2Marshaller as in my case.
Please note,
- The classes are generated using XJC. Not including here to ensure that i dont clutter with unnecessary information. let me know if more info is required.
- We are not having any control on the xml soap response sent from server and hence we may not be able to change them.