ASP.NET 1.1 - XPathNavigator OuterXml equivalent - equivalent

I'm working with the Google Maps API to do GeoCode lookups in 1.1 and I'm running into a brick wall with the XPathNavigator object.
I need to create a "sub-navigator" so that we can perform global xpath searches for nodes (e.g. //adr:PostalCodeNumber) because the xml schema changes depending upon the accuracy of the Address returned.
Here's a sample response:
<kml xmlns="http://earth.google.com/kml/2.0"><Response>
<name>2601 S. McKenzie Street </name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>2601 S McKenzie St, Foley, AL 36535, USA</address>
<AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>AL</AdministrativeAreaName><Locality><LocalityName>Foley</LocalityName><Thoroughfare><ThoroughfareName>2601 S McKenzie St</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>36535</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
<ExtendedData>
<LatLonBox north="30.3733653" south="30.3706673" east="-87.6817548" west="-87.6844528" />
</ExtendedData>
<Point><coordinates>-87.6831038,30.3720163,0</coordinates></Point>
</Placemark>
<Placemark id="p2">
<address>2601 S McKenzie St, Gulf Shores, AL 36542, USA</address>
<AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Country> <CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>AL</AdministrativeAreaName><Locality><LocalityName>Gulf Shores</LocalityName><Thoroughfare><ThoroughfareName>2601 S McKenzie St</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>36542</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
<ExtendedData>
<LatLonBox north="30.3093758" south="30.3066778" east="-87.6818443" west="-87.6845423" />
</ExtendedData>
<Point><coordinates>-87.6832047,30.3080269,0</coordinates></Point>
</Placemark>
</Response></kml>
I've got this 2.0 block of code and I'm trying to find a 1.1 equivalent for the OuterXml property:
private XPathNavigator CreateSubNavigator(XPathNavigator nav)
{
using (StringReader reader = new StringReader(nav.OuterXml))
{
XPathDocument doc = new XPathDocument(reader);
return doc.CreateNavigator();
}
}
I found this blog article, but the links to the SerializableXPathNavigator source are dead. =(
http://www.tkachenko.com/blog/archives/000155.html
Forgive me for my noobness, but how would I go about writing my own SerializableXPathNavigator class with my own OuterXml method?
Thanks so much for your help.

Related

AutocompleteInput suggestions are not working

I'm working on a project in react-admin and am trying to use an AutocompleteInputs within ReferenceInputs for Filter in a List. The list is a product that has a relationship with two different users, a consumer and provider. I'm currently able to obtain the choices for consumers and providers and filter my product list by either.
However, my issues arises with the autosuggestion. It's simply not working. Typing in the AutocompleteInput will not filter the choices to select from for either consumers or providers. I have another AutocompleteArrayInput within an ArrayReferenceInput for providers that's setup similarly and the autosuggestion is working perfectly fine.
Any thoughts?
Here's the broken AutocompleteInput:
export const ProductFilter = props => (
<Filter {...props}>
<ReferenceInput label="Consumer" reference="consumers"
source="consumer_user_id" allowEmpty>
<AutocompleteInput source="id" optionText={FullNameRenderer} />
</ReferenceInput>
<ReferenceInput label="Provider" reference="providers"
source="provider_user_id" alwaysOn allowEmpty>
<AutocompleteInput optionText={FullNameRenderer} />
</ReferenceInput>
<DateRangeInput alwaysOn />
</Filter>
)
And this is the working AutocompleteArrayInput:
export const ConsumerEdit = props => (
<Edit {...props}>
<TabbedForm redirect="show">
<FormTab label="Providers" path="provider_assignmenmts">
<ReferenceArrayInput label='Assigned Providers'
reference='providers' defaultValue={[]}
source="provider_ids" allowEmpty>
<AutocompleteArrayInput optionText={FullNameRenderer}/>
</ReferenceArrayInput>
</FormTab>
</TabbedForm>
</Edit>
)
In the component <AutocompleteInput source = "id" optionText = {FullNameRenderer} /> the attribute source = "id" is superfluous.
Well, it looks like this one is a larger issue within react-admin.
https://github.com/marmelab/react-admin/issues/3098

DocuSign API not asking or setting the dateSigned though it is present in the xml

Having followed the example found earlier here on StackOverflow (dateSignedTabs does not work), I still fail to get a signature date to appear. Here's a snippet of the xml.
<?xml version="1.0" encoding="UTF-8"?>
<envelopeDefinition xmlns="http://www.docusign.com/restapi">
<emailSubject>Boiler Contract -00006)</emailSubject>
<status>sent</status>
<documents>
<document>
<documentId>1</documentId>
<name>VDBK SW6-CSIK-0001.pdf</name>
</document>
</documents>
<recipients>
<signers>
<signer>
<recipientId>1</recipientId>
<routingOrder>1</routingOrder>
<note>Team</note>
<email>joebloggs#gmail.com</email>
<name>Eric Test6-1</name>
<tabs>
<signHereTabs>
<signHere>
<xPosition>58</xPosition>
<yPosition>617</yPosition>
<documentId>1</documentId>
<pageNumber>1</pageNumber>
</signHere>
</signHereTabs>
<dateSignedTabs>
<dateSigned>
<xPosition>58</xPosition>
<yPosition>440</yPosition>
<tabLabel>Date Signed</tabLabel>
<name>Date Signed</name>
<documentId>1</documentId>
<pageNumber>1</pageNumber>
<recipientId>1</recipientId>
</dateSigned>
</dateSignedTabs>
</tabs>
</signer>
</signers>
</recipients>
</envelopeDefinition>
Can anybody spot why this is off?

Finding a CID reference for attachments in Exchange Contacts

I'm crafting a powershell program using EWS that:
Recover some data from a backup contact folder (telephone, url, notes field,...)
Set back those values in default contact folder in the new contact
Everything does work except, of course, attachents that were added to notes fields, still i'm able to download them.
foreach ($attch in $Item.Attachments)
{
$downloadDirectory = ".\attachments"
$attch.Load()
$fiFile = new-object System.IO.FileStream(($downloadDirectory + “\” + $attch.Name.ToString()), [System.IO.FileMode]::Create)
$fiFile.Write($attch.Content, 0, $attch.Content.Length)
$fiFile.Close()
write-host "Downloaded Attachment : " + (($downloadDirectory + “\” + $attch.Name.ToString()))
}
Or upload them. (it's static here for test purpose)
$att = $item.Attachments.AddFileAttachment("C:\Scripts\myscript\attachments\PowerShell_transcript.20140506143510.txt")
$att.ContentId = 'test'
$att.IsInline=$false
Ideally, i was looking for matching CID references and uplading back attachments using the same one.
<div><font face="Calibri" size="2"><span style="font-size:11pt;">
<img src="cid:0DF540471453B832E300400FF03B0900CFEC1201#1">
SomeDoc.docx
</span></font></div>
Of course, when the object retrieved from exchange, it doesn't have a contentid (I would have guess it should be CID value).
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>Microsoft.Exchange.WebServices.Data.FileAttachment</T>
<T>Microsoft.Exchange.WebServices.Data.Attachment</T>
<T>Microsoft.Exchange.WebServices.Data.ComplexProperty</T>
<T>System.Object</T>
</TN>
<ToString>Microsoft.Exchange.WebServices.Data.FileAttachment</ToString>
<Props>
<Nil N="FileName" />
<BA N="Content"></BA>
<B N="IsContactPhoto">false</B>
<S N="Id">AAMkADdmMDBkOTk4LTNlYzMtNDk1MS05ZTdhLWJmOGE.....</S>
<S N="Name">SomeDoc.docx</S>
<S N="ContentType">application/vnd.openxmlformats-officedocument.wordprocessingml.document</S>
<Nil N="ContentId" /> <=== WHERE IS MY VALUE :'(
<Nil N="ContentLocation" />
<I32 N="Size">1764632</I32>
<DT N="LastModifiedTime">2016-01-26T15:08:03+00:00</DT>
<B N="IsInline">false</B>
</Props>
</Obj>
</Objs>
Does someone know a way to retrieve that value ?
Server/mailbox: Exchange 2013 SP1
Thank you !
it doesn't have a contentid (I would have guess it should be CID value).
An Attachment would only have cid if it was on Inline Attachment in a Mime Message https://www.ietf.org/rfc/rfc2111.txt in a contact it would never be valid (eg even the contact picture doesn't have a cid) as your dealing with Exchange Data Type.
Cheers
Glen

Orbeon control details in own component

I'm making my own component, and I want to have oportunity to set some properties in form builder. In all I want to reach effect similar to autocomplete control, where I can set 3 properties (URI, xpath, and relative xpath). I read, that I can do it using control-details markup, but unfortunately it does not work. This is code (I working on davinci tutorial):
<xbl:binding element="fr|tutorial-davinci" id="fr-tutorial-davinci" xxbl:mode="lhha binding value">
<metadata xmlns="http://orbeon.org/oxf/xml/form-builder" xmlns:xf="http://www.w3.org/2002/xforms">
<display-name lang="en">davinci-modified</display-name>
<templates>
<instance label=""/>
<view>
<fr:tutorial-davinci id="" appearance="minimal" labelref="#label" xmlns="" resource="" >
<xf:label ref=""/>
<xf:hint ref=""/>
<xf:help ref=""/>
<xf:alert ref=""/>
</fr:tutorial-davinci>
</view>
</templates>
<control-details>
<xf:input>
<xf:label lang="en">Some param</xf:label>
</xf:input>
</control-details>
</metadata>
<xbl:template>
<xf:model>
<xf:instance id="id1"><value/></xf:instance>
</xf:model>
<xf:input ref="instance('id1')" />
</xbl:template>
</xbl:binding>
You must have a ref attribute on<xf:input> which points to an attribute or element where the information will be stored. In autocomplete.xml, there is in particular theresource` attribute, which:
is pointed to by <xf:input>
is present on the <fr:autocomplete> template

suds: incorrect marshaling of Array of Arrays

I try to talk to a load balancer (Zeus ZXTM) with python:
a = client.factory.create('StringArrayArray')
b = client.factory.create('StringArray')
b.value = ['node01:80',]
a.value = [b,]
client.service.addDrainingNodes(['my pool'], a)
But I get the following error:
suds.WebFault: Server raised fault: 'Not an ARRAY reference at /usr/local/zeus/zxtmadmin/lib/perl/Zeus/ZXTM/SOAPBase.pm line 772.
Extract of the schema definition:
<types>
<xsd:schema targetNamespace='http://soap.zeus.com/zxtm/1.0/'
xmlns='http://www.w3.org/2001/XMLSchema'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'>
<xsd:complexType name="StringArray">
<xsd:complexContent>
<xsd:restriction base='SOAP-ENC:Array'>
<xsd:attribute ref='SOAP-ENC:arrayType' wsdl:arrayType='xsd:string[]'/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="StringArrayArray">
<xsd:complexContent>
<xsd:restriction base='SOAP-ENC:Array'>
<xsd:attribute ref='SOAP-ENC:arrayType' wsdl:arrayType='zeusns:StringArray[]'/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>
<message name="addDrainingNodesRequest">
<part name="names" type="zeusns:StringArray" />
<part name="values" type="zeusns:StringArrayArray" />
</message>
<message name="addDrainingNodesResponse"></message>
<portType name="PoolPort">
<operation name="addDrainingNodes">
<documentation>
Add nodes to the lists of draining nodes, for each of the named pools.
</documentation>
<input message="zeusns:addDrainingNodesRequest"/>
<output message="zeusns:addDrainingNodesResponse"/>
</operation>
</portType>
</definitions>
I also tried like this:
client.service.addDrainingNodes(['my pool'], [['node01:80']])
which worked in SOAPpy but now in suds I get:
suds.WebFault: Server raised fault: 'Value isn't an array'
Comparison between what SOAPpy and what suds sends:
SOAPpy (works):
<ns1:addDrainingNodes xmlns:ns1="http://soap.zeus.com/zxtm/1.0/Pool/" SOAP-ENC:root="1">
<v1 SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">
<item>my pool</item>
</v1>
<v2 SOAP-ENC:arrayType="xsd:list[1]" xsi:type="SOAP-ENC:Array">
<item SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">
<item>node01:80</item>
</item>
</v2>
</ns1:addDrainingNodes>
suds (doesn't work):
<ns4:addDrainingNodes>
<names xsi:type="ns0:StringArray" ns3:arrayType="ns2:string[1]">
<item xsi:type="ns2:string">my pool</item>
</names>
<values xsi:type="ns0:StringArrayArray" ns3:arrayType="ns0:StringArray[1]">
<item xsi:type="ns2:string">node01:80</item>
</values>
</ns4:addDrainingNodes>
Context:
I'm new to suds and Soap
there's only the SOAP interface to the ZXTM loadbalancer
using python2.6 and suds 0.3.9
we used to use ZSI's SOAPpy, but had issues using it under python 2.6
Edit: Added suds/SOAPpy payloads
After trying
zillions of different arguments to this function
wsdl2py from ZSI
I found out that suds 4.0 offers plugins, that solves this case by hacking, but nonetheless I think that's a suds bug:
class FixArrayPlugin(Plugin):
def sending(self, context):
command = context.envelope.getChild('Body').getChildren()[0].name
if command == 'addDrainingNodes':
context.envelope.addPrefix('xsd', 'http://www.w3.org/1999/XMLSchema')
values = context.envelope.getChild('Body').getChild('addDrainingNodes').getChild('values')
values.set('SOAP-ENC:arrayType', 'xsd:list[1]')
values.set('xsi:type', 'SOAP-ENC:Array')
item = values[0]
item.set('SOAP-ENC:arrayType', 'xsd:list[1]')
item.set('xsi:type', 'SOAP-ENC:Array')
client = Client(wsdl, location=location, plugins=[FixArrayPlugin()])
a = client.factory.create('StringArrayArray')
b = client.factory.create('StringArray')
b.item = ['node01:80']
a.item = [b,]
client.service.addDrainingNodes(['my pool'], a)
I'm looking forward for this issue to be fixed, IMO this should be a one liner
I'm leaving this open as I'm still interested in better alternatives
What looks strange to me is you have to explicitly construct types like 'StringArrayArray' and 'StringArray' - a smart enough SOAP client in a language like python should be able to figure this out via reflection, examining the arguments you pass to the service call. I'm guessing they're declared in the wsdl as something like "SOAP-ENC:Array" - if so they're not intended to be objects. That would also make sense with the error message "Not an ARRAY reference". Have you tried just;
a = [ ['node01:80',], ]
client.service.addDrainingNodes(['my pool'], a)
Or failing that perhaps...
a = client.factory.create('StringArrayArray')
b = ['node01:80',]
a.value = [ b, ]
client.service.addDrainingNodes(['my pool'], a)
Good luck.