2016-11-23 5 views
2

を持つWebサービスを消費しています。親子関係VBまたはC#

私は、特定の患者がいる医薬品のリストをWebサービスに更新する必要があります。私は患者のIDと投薬リストを送付しています。私は、次のWSDL

<?xml version="1.0" encoding="UTF-8"?> 

-<wsdl:definitions name="GOLDSessionResponseService" 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
xmlns:tns="http://City.health.xxx.au/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" 
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" 
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
targetNamespace="http://City.health.xxx.au/"> 

-<wsdl:types> 

-<xs:schema targetNamespace="http://City.health.xxx.au/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> 

    <xs:import namespace="http://schemas.datacontract.org/2004/07/City.Services.GOLD"/> 


    -<xs:element name="SessionCompleted"> 


    -<xs:complexType> 


     -<xs:sequence> 

     <xs:element type="q1:SessionCompletionRequest" name="request" xmlns:q1="http://schemas.datacontract.org/2004/07/City.Services.GOLD" nillable="true" minOccurs="0"/> 

     </xs:sequence> 

    </xs:complexType> 

    </xs:element> 


    -<xs:element name="SessionCompletedResponse"> 


    -<xs:complexType> 


     -<xs:sequence> 

     <xs:element type="q2:SessionCompletionResponse" name="SessionCompletedResult" nillable="true" minOccurs="0" xmlns:q2="http://schemas.datacontract.org/2004/07/City.Services.GOLD"/> 

     </xs:sequence> 

    </xs:complexType> 

    </xs:element> 


    -<xs:element name="UpdateMedications"> 


    -<xs:complexType> 


     -<xs:sequence> 

     <xs:element type="q3:UpdateMedicationsRequest" name="request" nillable="true" minOccurs="0" xmlns:q3="http://schemas.datacontract.org/2004/07/City.Services.GOLD"/> 

     </xs:sequence> 

    </xs:complexType> 

    </xs:element> 


    -<xs:element name="UpdateMedicationsResponse"> 


    -<xs:complexType> 


     -<xs:sequence> 

     <xs:element type="q4:UpdateMedicationsResponse" name="UpdateMedicationsResult" nillable="true" minOccurs="0" xmlns:q4="http://schemas.datacontract.org/2004/07/City.Services.GOLD"/> 

     </xs:sequence> 

    </xs:complexType> 

    </xs:element> 

</xs:schema> 


-<xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified"> 

    <xs:element type="xs:anyType" name="anyType" nillable="true"/> 

    <xs:element type="xs:anyURI" name="anyURI" nillable="true"/> 

    <xs:element type="xs:base64Binary" name="base64Binary" nillable="true"/> 

    <xs:element type="xs:boolean" name="boolean" nillable="true"/> 

    <xs:element type="xs:byte" name="byte" nillable="true"/> 

    <xs:element type="xs:dateTime" name="dateTime" nillable="true"/> 

    <xs:element type="xs:decimal" name="decimal" nillable="true"/> 

    <xs:element type="xs:double" name="double" nillable="true"/> 

    <xs:element type="xs:float" name="float" nillable="true"/> 

    <xs:element type="xs:int" name="int" nillable="true"/> 

    <xs:element type="xs:long" name="long" nillable="true"/> 

    <xs:element type="xs:QName" name="QName" nillable="true"/> 

    <xs:element type="xs:short" name="short" nillable="true"/> 

    <xs:element type="xs:string" name="string" nillable="true"/> 

    <xs:element type="xs:unsignedByte" name="unsignedByte" nillable="true"/> 

    <xs:element type="xs:unsignedInt" name="unsignedInt" nillable="true"/> 

    <xs:element type="xs:unsignedLong" name="unsignedLong" nillable="true"/> 

    <xs:element type="xs:unsignedShort" name="unsignedShort" nillable="true"/> 

    <xs:element type="tns:char" name="char" nillable="true"/> 


    -<xs:simpleType name="char"> 

    <xs:restriction base="xs:int"/> 

    </xs:simpleType> 

    <xs:element type="tns:duration" name="duration" nillable="true"/> 


    -<xs:simpleType name="duration"> 


    -<xs:restriction base="xs:duration"> 

     <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/> 

     <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/> 

     <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/> 

    </xs:restriction> 

    </xs:simpleType> 

    <xs:element type="tns:guid" name="guid" nillable="true"/> 


    -<xs:simpleType name="guid"> 


    -<xs:restriction base="xs:string"> 

     <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/> 

    </xs:restriction> 

    </xs:simpleType> 

    <xs:attribute type="xs:QName" name="FactoryType"/> 

    <xs:attribute type="xs:ID" name="Id"/> 

    <xs:attribute type="xs:IDREF" name="Ref"/> 

</xs:schema> 


-<xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/City.Services.GOLD" targetNamespace="http://schemas.datacontract.org/2004/07/City.Services.GOLD" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> 


    -<xs:complexType name="SessionCompletionRequest"> 


    -<xs:sequence> 

     <xs:element type="xs:dateTime" name="AppointmentDateTime" minOccurs="0"/> 

     <xs:element type="xs:dateTime" name="NextAppointmentDateTime" minOccurs="0"/> 

     <xs:element type="xs:int" name="PatientId" minOccurs="0"/> 

     <xs:element type="xs:string" name="SessionLetter" nillable="true" minOccurs="0"/> 

     <xs:element type="xs:int" name="SessionNumber" minOccurs="0"/> 

     <xs:element type="xs:string" name="Status" nillable="true" minOccurs="0"/> 

    </xs:sequence> 

    </xs:complexType> 

    <xs:element type="tns:SessionCompletionRequest" name="SessionCompletionRequest" nillable="true"/> 


    -<xs:complexType name="SessionCompletionResponse"> 


    -<xs:sequence> 

     <xs:element type="xs:string" name="ErrorMessage" nillable="true" minOccurs="0"/> 

     <xs:element type="xs:boolean" name="Success" minOccurs="0"/> 

    </xs:sequence> 

    </xs:complexType> 

    <xs:element type="tns:SessionCompletionResponse" name="SessionCompletionResponse" nillable="true"/> 


    -<xs:complexType name="UpdateMedicationsRequest"> 


    -<xs:sequence> 

     <xs:element type="tns:Medication" name="Medications" nillable="true" minOccurs="0"/> 

     <xs:element type="xs:int" name="PatientId" minOccurs="0"/> 

    </xs:sequence> 

    </xs:complexType> 

    <xs:element type="tns:UpdateMedicationsRequest" name="UpdateMedicationsRequest" nillable="true"/> 


    -<xs:complexType name="Medication"> 


    -<xs:sequence> 

     <xs:element type="xs:string" name="BrandName" nillable="true" minOccurs="0"/> 

     <xs:element type="xs:string" name="Generic" nillable="true" minOccurs="0"/> 

    </xs:sequence> 

    </xs:complexType> 

    <xs:element type="tns:Medication" name="Medication" nillable="true"/> 


    -<xs:complexType name="UpdateMedicationsResponse"> 


    -<xs:sequence> 

     <xs:element type="xs:string" name="ErrorMessage" nillable="true" minOccurs="0"/> 

     <xs:element type="xs:boolean" name="Success" minOccurs="0"/> 

    </xs:sequence> 

    </xs:complexType> 

    <xs:element type="tns:UpdateMedicationsResponse" name="UpdateMedicationsResponse" nillable="true"/> 

</xs:schema> 

-<wsdl:message name="IGOLDSessionResponseService_SessionCompleted_InputMessage"> 

    <wsdl:part name="parameters" element="tns:SessionCompleted"/> 

</wsdl:message> 


-<wsdl:message name="IGOLDSessionResponseService_SessionCompleted_OutputMessage"> 

    <wsdl:part name="parameters" element="tns:SessionCompletedResponse"/> 

</wsdl:message> 


-<wsdl:message name="IGOLDSessionResponseService_UpdateMedications_InputMessage"> 

    <wsdl:part name="parameters" element="tns:UpdateMedications"/> 

</wsdl:message> 


-<wsdl:message name="IGOLDSessionResponseService_UpdateMedications_OutputMessage"> 

    <wsdl:part name="parameters" element="tns:UpdateMedicationsResponse"/> 

</wsdl:message> 


-<wsdl:portType name="IGOLDSessionResponseService"> 


-<wsdl:operation name="SessionCompleted"> 

    <wsdl:input message="tns:IGOLDSessionResponseService_SessionCompleted_InputMessage" wsaw:Action="http://City.health.xxx.au/IGOLDSessionResponseService/SessionCompleted"/> 

    <wsdl:output message="tns:IGOLDSessionResponseService_SessionCompleted_OutputMessage" wsaw:Action="http://City.health.xxx.au/IGOLDSessionResponseService/SessionCompletedResponse"/> 

</wsdl:operation> 


-<wsdl:operation name="UpdateMedications"> 

    <wsdl:input message="tns:IGOLDSessionResponseService_UpdateMedications_InputMessage" wsaw:Action="http://City.health.xxx.au/IGOLDSessionResponseService/UpdateMedications"/> 

    <wsdl:output message="tns:IGOLDSessionResponseService_UpdateMedications_OutputMessage" wsaw:Action="http://City.health.xxx.au/IGOLDSessionResponseService/UpdateMedicationsResponse"/> 

</wsdl:operation> 

-<wsdl:binding type="tns:IGOLDSessionResponseService" name="BasicHttpBinding_IGOLDSessionResponseService"> 

<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> 


-<wsdl:operation name="SessionCompleted"> 

    <soap:operation style="document" soapAction="http://City.health.xxx.au/IGOLDSessionResponseService/SessionCompleted"/> 


    -<wsdl:input> 

    <soap:body use="literal"/> 

    </wsdl:input> 


    -<wsdl:output> 

    <soap:body use="literal"/> 

    </wsdl:output> 

</wsdl:operation> 


-<wsdl:operation name="UpdateMedications"> 

    <soap:operation style="document" soapAction="http://City.health.xxx.au/IGOLDSessionResponseService/UpdateMedications"/> 


    -<wsdl:input> 

    <soap:body use="literal"/> 

    </wsdl:input> 


    -<wsdl:output> 

    <soap:body use="literal"/> 

    </wsdl:output> 

</wsdl:operation> 

</wsdl:binding> 


-<wsdl:service name="GOLDSessionResponseService"> 


-<wsdl:port name="BasicHttpBinding_IGOLDSessionResponseService" binding="tns:BasicHttpBinding_IGOLDSessionResponseService"> 

    <soap:address location="http://services.City.simient.com/GOLD/GOLDSessionResponseService.svc"/> 

</wsdl:port> 

が提供されている私は自分のプロジェクトにWebReferenceを追加したとtを消費しようとしています彼はサービスする。薬を患者にリンクしようとするとエラーが発生します。

コードが下に表示されます。

Dim medadd As Services.UpdateMedicationsRequest = New Services.UpdateMedicationsRequest() 
Dim medresponse As Services.UpdateMedicationsResponse = New Services.UpdateMedicationsResponse() 

Dim medlist As Medication = New Medication() 


medadd.PatientId = CInt(patientid) 
medadd.PatientIdSpecified = True 
medlist.BrandName = "testbrand" 
medlist.Generic = "testgeneric" 


medadd.Medications = medlist?????? 


medresponse = client.UpdateMedications(medadd) 

私は親クラスに薬を追加しようとしているで立ち往生しています。

任意の提案は非常にあなたが特定のaddメソッドを使用する必要があり、ちょうど薬の投薬要素を割り当てないように、薬物要素の集合であるジョー・

答えて

0

medadd.Medications

をいただければ幸いです

medadd.Medications.Add(medlist); 

医薬品がまだ割り当てられていない場合(nil)、neを作成する必要がある場合追加操作を実行する前に薬のワット空のリスト

Dim medications As New List(Of Medication)(); 
medications.Add(medlist); 
medadd.Medications = medications; 

いくつかの問題を発生させることができますもう一つは、医薬品のためminOccurs = 0です。それはminOccurs = 1

+0

こんにちは、あなたのフィードバックのおかげで、それは道に沿って私を助けているはずです。しかし、あなたの最後のコード行は私のためにエラーを生成します。(Medicationの)Listの値はMedication()に変換できません。私はあなたにこれについての提案を提供できることを願っています。 – Joe

+0

これは 'medadd.Medications'のタイプですか? – cristallo

+0

medadd.MedicationsはMedicationのタイプです。問題はwsdlにありますか?これを手伝ってくれてありがとうございます:) – Joe