Bing SDS Geofence Schema - geolocation

I have created and published a data source with Bing SDS but it is a singular point and am wondering how to create a data source that defines an area?
Essentially I need a geo-fence around a certain point. Below is what my schema currently looks like, what parameters do I need to add to it to define an area?
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<MainRoot>
<xs:schema id="FourthCoffeeShops_ds" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="FourthCoffeeShops_ds" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="FourthCoffeeShops">
<xs:complexType>
<xs:sequence>
<xs:element name="EntityID" type="xs:string" />
<xs:element name="AddressLine" type="xs:string" minOccurs="0" />
<xs:element name="Locality" type="xs:string" minOccurs="0" />
<xs:element name="AdminDistrict" type="xs:string" minOccurs="0" />
<xs:element name="PostalCode" type="xs:string" minOccurs="0" />
<xs:element name="CountryRegion" type="xs:string" minOccurs="0" />
<xs:element name="Phone" type="xs:string" minOccurs="0" />
<xs:element name="Manager" type="xs:string" minOccurs="0" />
<xs:element name="Latitude" type="xs:double" minOccurs="0" />
<xs:element name="Longitude" type="xs:double" minOccurs="0" />
<xs:element name="Confidence" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//FourthCoffeeShops" />
<xs:field xpath="EntityID" />
</xs:unique>
</xs:element>
</xs:schema>
<FourthCoffeeShops>
<EntityID>1000</EntityID>
<AddressLine>1 Microsoft Way</AddressLine>
<Locality>Redmond</Locality>
<AdminDistrict>WA</AdminDistrict>
<PostalCode>98052</PostalCode>
<Phone>303-555-0188</Phone>
<Manager>Alan Steiner</Manager>
<Latitude>47.640049</Latitude>
<Longitude>-122.129797</Longitude>
<Confidence>High</Confidence>
</FourthCoffeeShops>
<FourthCoffeeShops>
<EntityID>1001</EntityID>
<AddressLine>1 Microsoft Way</AddressLine>
<Locality>Redmond</Locality>
<AdminDistrict>WA</AdminDistrict>
<PostalCode>98052</PostalCode>
<CountryRegion>United States</CountryRegion>
<Phone>425-555-0111</Phone>
<Manager>Phil Spencer</Manager>
<Latitude>47.639767</Latitude>
<Longitude>-122.129959</Longitude>
<Confidence>Medium</Confidence>
</FourthCoffeeShops>
</MainRoot>
To be clear by an area I mean a certain radius around a location or a polygon that contains the location.
Thanks!

You can create a column that is of type "Edm.Geography" or "xs:anyType". This property type takes in Well Known Text, a standard way of representing spatial shapes as text. This allows you to store common spatial shapes such as Point, LineString, Polygon, Multipoint, MultiLineString, MultiPolygon, GeometryCollection. Here is the documentation around this:
https://msdn.microsoft.com/en-us/library/gg585138.aspx
https://msdn.microsoft.com/en-us/library/dn436149.aspx
To represent a GeoFence you will want to create a Polygon that represents the area you want. If you want to represent a circle you will need to calculate the points that approximate the circle: http://pietschsoft.com/post/2008/02/09/Virtual-Earth-Draw-a-Circle-Radius-Around-a-LatLong-Point
Here is a blog post on using Geofences stored in SDS with tracked devices: http://blogs.msdn.com/b/bingdevcenter/archive/2014/04/03/geo-fencing-with-bing-spatial-data-services-and-azure-mobile-services.aspx

Related

Create output Xml file from XML and XSD using DataSet

I've got two example files: note.xml and note.xsd. I would like to combine this two files using DataSet and create output XML file, based on this operation. How can i do it?
note.xml
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
note.xsd
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.w3schools.com"
xmlns="https://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
UPDATE
Basically, i would like to combine XSD and XML and create output XML file. I want to use something like data table relations(DataSet)
Then after combine, we can decide based on data type(string, int..), which for example: dataform can store this.

Invalid Content Was Found Starting With Element 'country'. One Of '{country}' Is Expected.. Line '10', Column '14'

I am trying to resolve this issue but could not understand the root cause of this error:
Invalid Content Was Found Starting With Element 'country'. One Of '{country}' Is Expected.. Line '10', Column '14'
Here is my xml:
<?xml version="1.0"?>
<!--DTD file reference-->
<!--<!DOCTYPE countries SYSTEM "http://localhost:8080/ajaxprac/file.dtd">-->
<!--DTD file reference-->
<!---->
<countries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://localhost:8080/ajaxprac"
xsi:schemaLocation="http://localhost:8080/ajaxprac fileSchema.xsd">
<country>
<name>pakistan</name>
<cities>
<city>Kassowal</city>
<city>Faisalabad</city>
<city>Multan</city>
</cities>
</country>
<country>
<name>india</name>
<cities>
<city>Agra</city>
<city>Amritsar</city>
<city>Ayodhya</city>
</cities>
</country>
</countries>
and xsd file for this is:
<?xml version="1.0"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://localhost:8080/ajaxprac"
xmlns="http://localhost:8080/ajaxprac">
<xs:element name="countries" type="countriesType"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:complexType name="countriesType">
<xs:sequence>
<xs:element name="country" type="countryType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="countryType">
<xs:sequence>
<xs:element ref="name"/>
<xs:element name="cities" type="citiesType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="citiesType">
<xs:sequence>
<xs:element ref="city"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
As written, your schema expects the "global" countries, name and city elements to be in the http://localhost:8080/ajaxprac namespace, but the "local" elements (those declared inside a complexType, i.e. country and cities) to be in no namespace. You probably want to add elementFormDefault="qualified", i.e.
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://localhost:8080/ajaxprac"
xmlns="http://localhost:8080/ajaxprac"
elementFormDefault="qualified">
which applies the targetNamespace to local, as well as global, element declarations.

What does `extra classes` parameter from `Java2WSDL` do?

Does anyone know what extra classes parameter from Java2WSDL tool mean?
Java2DSDL Reference
I am looking to answer this question, but have no success.
It is used to include those types in WSDL definition whose parents appears as return types or parameters. Consider very simple example:
public class DemoService {
public Animal pickRandomAnimal() {
return new Dog(); // or any other animal
}
}
.. where Animal is an interface. At a WSDL generation time Axis2 will not be able to automatically trace all possible implementations of Animal that you might expect to be returned. Without extraClasses you'll get something like this:
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://demo.com/xsd">
<xs:complexType name="Animal">
<xs:sequence>
<xs:element minOccurs="0" name="animalName" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
.. and if you add extraClasses="com.demo.Dog", you'll cover all types you need in your WSDL schema part:
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://demo.com/xsd">
<xs:complexType name="Animal">
<xs:sequence>
<xs:element minOccurs="0" name="animalName" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Dog">
<xs:sequence>
<xs:element minOccurs="0" name="animalName" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

Recursive XmlSerializer losing elements

With C# and .Net 4.0, I have a recursive XSD schema. XML based on that XSD serializes just fine with XmlSerializer. It also deserializes with no errors, but without retrieving all of the elements.
Here's a snippit from the XSD:
<xs:complexType name="SettingGroup">
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Notes" type="xs:string" minOccurs="0" />
<xs:element name="SettingGroup" type="SettingGroup" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Setting" type="Setting" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
Note that the type SettingGroup recursively contains 0 or more SettingGroup elements, and also 0 or more elements of a different type named Setting. It works well when a SettingGroup contains just SettingGroups or when it contains just Settings. But, when the SettingGroup has both SettingGroups and Settings, although it serializes as expected, when deserialized, all of the Settings elements are missing.
I have also tried using ref, with similar results:
<xs:element ref="SettingGroup" minOccurs="0" maxOccurs="unbounded" />
I created the .xsd file by hand, and used xsd.exe to create the C# classes.
In case it may be of use, here's the definition of Setting:
<xs:complexType name="Setting">
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Notes" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="Roam" type="xs:boolean" minOccurs="0" default="true" />
<!--<xs:element name="RoamConditions" type="RoamConditions" />-->
<xs:element name="SettingLocation" type="SettingLocation" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
I'd appreciate any suggestions about why deserialization can't retrieve all elements.

biztalk map from unbounded with subelement to unbounded

source XSD structure:
documents (min occurs 1, max occurs 1)
document (min occurs 1, max occurs unbounded)
filename (min occurs 1, max occurs 1)
destination XSD structure:
documents (min occurs 1, max occurs 1)
filename (min occurs 1, max occurs unbounded)
How can this be done in the BizTalk mapper ?
(edit):
The 1st provided solution was my first implementation, but it seems that the Test Map option(right-mouse on the BizTalk map .btm file) in BizTalk sometimes needs an extra compile (I only saved the map and then I tested the map with the Test Map option). Now it works.
In Biztalk 2009 (and presumably also 2006) just connect the "filename" nodes.
Source schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://source" targetNamespace="http://source" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="documents">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" name="document">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="filename" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Destination schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://destination" targetNamespace="http://destination" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="documents">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" name="filename" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Map:
<?xml version="1.0" encoding="utf-16"?>
<mapsource Name="BizTalk Map" BizTalkServerMapperTool_Version="2.0" Version="2" XRange="100" YRange="420" OmitXmlDeclaration="Yes" TreatElementsAsRecords="No" OptimizeValueMapping="Yes" GenerateDefaultFixedNodes="Yes" PreserveSequenceOrder="No" CopyPIs="No" method="xml" xmlVersion="1.0" IgnoreNamespacesForLinks="Yes">
<SrcTree>
<Reference Location="source.xsd" />
</SrcTree>
<TrgTree>
<Reference Location="destination.xsd" />
</TrgTree>
<ScriptTypePrecedence>
<CSharp Enabled="Yes" />
<ExternalAssembly Enabled="Yes" />
<VbNet Enabled="Yes" />
<JScript Enabled="Yes" />
<XsltCallTemplate Enabled="Yes" />
<Xslt Enabled="Yes" />
</ScriptTypePrecedence>
<TreeValues>
<TestValues />
<ConstantValues />
</TreeValues>
<Pages>
<Page Name="Page 1">
<Links>
<Link LinkID="1" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='documents']/*[local-name()='document']/*[local-name()='filename']" LinkTo="/*[local-name()='<Schema>']/*[local-name()='documents']/*[local-name()='filename']" Label="" />
</Links>
<Functoids />
</Page>
</Pages>

Resources