i'm trying connect 3g network using mbn api. when call connect method in imbnconnection
throws exception.
the network connection profile corrupted. (exception hresult: 0x800704b6)
i have tried find typos , other errors in profile generate in code using microsoft's mobile broadband documentation (link), can't find one.
i found on blog hresult can wrong imsi number (here), connected manually windows , compared numbers in profile 1 in properties of connection , found same, both imsi , icc numbers.
this how xml generated.
<mbnprofile xmlns="http://www.microsoft.com/networking/wwan/profile/v1"> <name>boomer3g</name> <iconfilepath>link/to/bmpfile</iconfilepath> <description>3g network profile created boomerweb</description> <isdefault>true</isdefault> <profilecreationtype>userprovisioned</profilecreationtype> <subscriberid>imsi number (i counted 15 characters)</subscriberid> <simiccid>icc number (i counted 19 characters)</simiccid> <autoconnectoninternet>false</autoconnectoninternet> <connectionmode>auto</connectionmode> </mbnprofile>
and code generated xml profile. //xml namespaces
xnamespace xmlns = xnamespace.get("http://www.microsoft.com/networking/wwan/profile/v1"); xdocument xmldocument = new xdocument( new xelement(xmlns + "mbnprofile", new xelement(xmlns + "name", "boomer3g"), new xelement(xmlns + "iconfilepath", path.getfullpath("resource/kpn-icon.bmp")), new xelement(xmlns + "description", "3g network profile created boomerweb"), new xelement(xmlns + "isdefault", true), new xelement(xmlns + "profilecreationtype", "userprovisioned"), new xelement(xmlns + "subscriberid", subscriberinfo.subscriberid), new xelement(xmlns + "simiccid", subscriberinfo.simiccid), new xelement(xmlns + "autoconnectoninternet", false), new xelement(xmlns + "connectionmode", "auto") ) ); //create xml document string xml; xmlwritersettings xmlwriterset = new xmlwritersettings(); xmlwriterset.omitxmldeclaration = true; using (stringwriter strwriter = new stringwriter()) using (xmlwriter xwriter = xmlwriter.create(strwriter, xmlwriterset)) { xmldocument.writeto(xwriter); xwriter.flush(); xml = strwriter.getstringbuilder().tostring(); }
what else can give hresult? can guys give example of mbn profile? or there wrong in code generates profile?
guys have solved problem. turns out dind't had xml declaration above xml.
my xml this:
<?xml version="1.0" encoding="utf-8" ?> <mbnprofile xmlns="http://www.microsoft.com/networking/wwan/profile/v1"> <name>boomer3g</name> <iconfilepath>link/to/bmpfile</iconfilepath> <description>3g network profile created boomerweb</description> <isdefault>true</isdefault> <profilecreationtype>userprovisioned</profilecreationtype> <subscriberid>imsi number (i counted 15 characters)</subscriberid> <simiccid>icc number (i counted 19 characters)</simiccid> <autoconnectoninternet>false</autoconnectoninternet> <connectionmode>auto</connectionmode> </mbnprofile>
so turns out nothing wrong code, removed shouldn't had. stupid mistake on part know.
Comments
Post a Comment