Aktuelles CSharp Beispiel

Wenn meinen SOAP Trace richtig lese, dann schickt IPS eine Antwort mit Default Encoding, also UTF-8. Die Zeichen in den String Values sind aber nach ANSI codiert. Ist das ein Bug?

Das gleiche Problem hatte ich auch schon mit Umlauten in Categories.

Gruß steve

Encoding ist CP1252. VariableCustomProfile überschreibt bei mir schon vorher VariableProfile, macht für die Anzeige ja keinen Unterschied. Associations sind immer Double, also reicht ein kleines System.Convert.ToDouble(value).

Wenn das Encoding aber cp1252 ist, dann muss das in der Soap-Response auch drin stehen. Ein GetProfile sieht bei mir aus:


REQUEST:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://localhost/" xmlns:types="http://localhost/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <q1:GetVariableProfile xmlns:q1="urn:UIPSTypes-IIPSVariableManager">
      <VarProfileName xsi:type="xsd:string">~Temperature</VarProfileName>
    </q1:GetVariableProfile>
  </soap:Body>
</soap:Envelope>

RESPONSE:
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="urn:UIPSTypes">
    <NS1:GetVariableProfileResponse xmlns:NS1="urn:UIPSTypes-IIPSVariableManager">
      <return href="#1" />
    </NS1:GetVariableProfileResponse>
    <NS2:TIPSVarProfile id="1" xsi:type="NS2:TIPSVarProfile">
      <ProfileName xsi:type="xsd:string">~Temperature</ProfileName>
      <ProfileType xsi:type="NS2:TIPSVarType">vtFloat</ProfileType>
      <Icon xsi:type="xsd:string">Temperature</Icon>
      <Prefix xsi:type="xsd:string">
      </Prefix>
      <Suffix xsi:type="xsd:string"> °C</Suffix>
      <MinValue xsi:type="xsd:double">-30</MinValue>
      <MaxValue xsi:type="xsd:double">70</MaxValue>
      <StepSize xsi:type="xsd:double">5</StepSize>
      <Digits xsi:type="xsd:int">1</Digits>
      <Associations xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="NS2:TIPSValueAssociation[0]" />
      <IsReadOnly xsi:type="xsd:boolean">true</IsReadOnly>
    </NS2:TIPSVarProfile>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Die Response propagiert kein explizites Encoding, also gilt Default = utf-8.

Ist ein Bug, oder?

Gruß Steve

Ich hab das gleiche Problem. Wenn ich mit C# und VS2008 den IIPSObjectManager als WebReferenz hinzufüge und die Namen der Kategorien mit GetName() abfrage. Dann wird aus der Kategorie Räume ein R??ume

Wie hast Du das gelöst?

Gruß Mirko

Das ist ein echter Encoding Bug, wie ich weiter oben schon geschrieben hab.

Ich hab das nur mit einem hässlichen Workaround in den Griff gekriegt:

Du mußt in die SOAP-Kommunikation eingreifen, ähnlich wie man z.B. einen Request-Response-Trace einklinkt. Dann kannst Du den Stream mit dem „richtigen“ Encoding lesen, egal was im XML steht.

Ist aber ein hässlicher Hack, mag ich kaum hier posten. Vielleicht kommst Du ja auf was besseres?

Eigentlicht muss das im IPS gefixt werden, denn man sollte schon das Encoding in der XML korrekt propagieren.

Gruß Steve

Ich hab’s mal auf die Bug-Liste gesetzt, mal sehen ob sich da was tut.

Gruß Mirko

@steve44: Ich wäre an Deinem häßlichen Hack interessiert :wink: