SOAPのお勉強中。
[WebMethod]
public string HelloWorld()
{
return “HelloWorld”;
}
public string HelloWorld()
{
return “HelloWorld”;
}
<soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/” />
</soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/” />
</soap:Body>
<soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>string</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>string</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
[WebMethod]
public string HelloWorld( string arg0, int arg1)
{
return “HelloWorld” + arg0 + arg1;
}
public string HelloWorld( string arg0, int arg1)
{
return “HelloWorld” + arg0 + arg1;
}
<soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/”>
<arg0>string</arg0>
<arg1>int</arg1>
</HelloWorld>
</soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/”>
<arg0>string</arg0>
<arg1>int</arg1>
</HelloWorld>
</soap:Body>
<soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>string</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>string</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
public string[] HelloWorld( string[] arg0, int[] arg1)
{
string[] result = new string[ 10];
return result;
}
{
string[] result = new string[ 10];
return result;
}
<soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/”>
<arg0>
<string>string</string>
<string>string</string>
</arg0>
<arg1>
<int>int</int>
<int>int</int>
</arg1>
</HelloWorld>
</soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/”>
<arg0>
<string>string</string>
<string>string</string>
</arg0>
<arg1>
<int>int</int>
<int>int</int>
</arg1>
</HelloWorld>
</soap:Body>
<soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>
<string>string</string>
<string>string</string>
</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>
<string>string</string>
<string>string</string>
</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
public string HelloWorld( ref string arg0, out int arg1)
{
arg0 = “hoge”;
arg1 = 10;
return “HelloWorld”;
}
{
arg0 = “hoge”;
arg1 = 10;
return “HelloWorld”;
}
<soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/”>
<arg0>string</arg0>
</HelloWorld>
</soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/”>
<arg0>string</arg0>
</HelloWorld>
</soap:Body>
<soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>string</HelloWorldResult>
<arg0>string</arg0>
<arg1>int</arg1>
</HelloWorldResponse>
</soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>string</HelloWorldResult>
<arg0>string</arg0>
<arg1>int</arg1>
</HelloWorldResponse>
</soap:Body>
public class TestData
{
public int a = 0;
private int b = 0;
};
[WebMethod]
public TestData HelloWorld( TestData arg)
{
return arg;
}
{
public int a = 0;
private int b = 0;
};
[WebMethod]
public TestData HelloWorld( TestData arg)
{
return arg;
}
<soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/”>
<arg>
<a>int</a>
</arg>
</HelloWorld>
</soap:Body>
<HelloWorld xmlns=”http://www.cagylogic.com/webservices/”>
<arg>
<a>int</a>
</arg>
</HelloWorld>
</soap:Body>
<soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>
<a>int</a>
</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
<HelloWorldResponse xmlns=”http://www.cagylogic.com/webservices/”>
<HelloWorldResult>
<a>int</a>
</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
[WebMethod]
public Bitmap GetBmpSoap0()
{
return new Bitmap( 128, 128);
}
public Bitmap GetBmpSoap0()
{
return new Bitmap( 128, 128);
}
System.Drawing.Bitmap に既定のパブリック コンストラクタが含まれていないため、シリアル化できません。
[WebMethod]
public System.IO.MemoryStream GetBmpSoap1()
{
Bitmap bmp = new Bitmap( 128, 128 );
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.Runtime.Serialization.IFormatter fmt = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter();
fmt.Serialize( ms, bmp );
return ms;
}
public System.IO.MemoryStream GetBmpSoap1()
{
Bitmap bmp = new Bitmap( 128, 128 );
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.Runtime.Serialization.IFormatter fmt = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter();
fmt.Serialize( ms, bmp );
return ms;
}
<soap:Body>
<GetBmpSoap1Response xmlns=”http://www.cagylogic.com/webservices/”>
<GetBmpSoap1Result>
<Capacity>int</Capacity>
</GetBmpSoap1Result>
</GetBmpSoap1Response>
</soap:Body>
<GetBmpSoap1Response xmlns=”http://www.cagylogic.com/webservices/”>
<GetBmpSoap1Result>
<Capacity>int</Capacity>
</GetBmpSoap1Result>
</GetBmpSoap1Response>
</soap:Body>
[WebMethod]
public byte[] GetBmpSoap2()
{
Bitmap bmp = new Bitmap( 128, 128 );
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.Runtime.Serialization.IFormatter fmt = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter();
fmt.Serialize( ms, bmp );
byte[] buf = new byte[(int)ms.Length];
ms.Seek( 0, System.IO.SeekOrigin.Begin );
ms.Read( buf, 0, buf.Length );
ms.Close();
return buf;
}
public byte[] GetBmpSoap2()
{
Bitmap bmp = new Bitmap( 128, 128 );
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.Runtime.Serialization.IFormatter fmt = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter();
fmt.Serialize( ms, bmp );
byte[] buf = new byte[(int)ms.Length];
ms.Seek( 0, System.IO.SeekOrigin.Begin );
ms.Read( buf, 0, buf.Length );
ms.Close();
return buf;
}
<soap:Body>
<GetBmpSoap2Response xmlns=”http://www.cagylogic.com/webservices/”>
<GetBmpSoap2Result>base64Binary</GetBmpSoap2Result>
</GetBmpSoap2Response>
</soap:Body>
<GetBmpSoap2Response xmlns=”http://www.cagylogic.com/webservices/”>
<GetBmpSoap2Result>base64Binary</GetBmpSoap2Result>
</GetBmpSoap2Response>
</soap:Body>
へぇへぇへぇへぇへぇ
[Serializable]
class TestData
{
}
とすべきでは?
なるほど。そんな属性があるのね。
基本的なシリアル化に記述を見つけました。
でもね、付けても付けなくても結果はかわらんみたい。
付けたほうがいいみたいだけど。
ごめん、片方がprivateだったのね。