JSON 데이터를 가져 와서 반환하는 WCF 서비스가 있습니다. 이 서비스를 호출하는 Android 모바일 앱WCF 서비스 (JSON) 및 Android 클라이언트 - 메시지 보안
- 가능한 경우 어떻게이 두 메시지를 암호화합니까?
- 그렇지 않은 경우 맞춤 암호화를 수행하는 방법은 무엇입니까?
편집 : 여기
는 서버와 클라이언트 측에 대한 추가 정보입니다.
이 서비스는 다음 같습니다
서비스 인터페이스 :
<ServiceContract()>
Public Interface ITest
<OperationContract()>
<WebInvoke(Method:="POST", RequestFormat:=WebMessageFormat.Json, ResponseFormat:=WebMessageFormat.Json, BodyStyle:=WebMessageBodyStyle.WrappedRequest)>
Function Test(header As RequestHeader, body As TestRequestResponse) As Boolean
End Interface
서비스 코드
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple, InstanceContextMode:=InstanceContextMode.Single)>
Public Class TestService
Implements ITest
Public Function Test(header As RequestHeader, body As TestRequestResponse) As Boolean Implements ITest.Test
Return True
End Function
End Class
의 Web.config
<system.serviceModel>
<services>
<service behaviorConfiguration="RMWS.TestBehavior" name="RMWS.TestService">
<endpoint address="Test" binding="webHttpBinding" behaviorConfiguration="WebBehavior" bindingConfiguration="WebBinding" contract="RMWS.ITest" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="WebBinding"/>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="RMWS.TestBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
클라이언트 호출
클라이언트 호출은 현재 테스트 용으로 만 자바 스크립트로 만들어진. 앞으로 클라이언트는 안드로이드 앱이 될 것이지만 일반적인 생각은 같습니다.
$.ajax({
type: "POST",
url: "http://localhost/RMWS/TestService.svc/Test/Test",
contentType: "application/json",
dataType: "json",
data: JSON.stringify(somedata),
success: function (data)
{
...
},
error: function (httpRequest, textStatus, errorThrown)
{
alert(textStatus + ": " + errorThrown);
}
});
편집 2 :
나는 그것이 SSL을 쉽게 수행 할 수 있습니다 알고 있습니다. 그러나 우리 회사에서는 성능과 트래픽이 너무 비싸므로 SSL을 사용하지 않고 대신 다른 암호화를 사용하려고합니다. 가능하다면 민감한 정보가 응답에 포함되지 않으므로 요청 만 인코딩 될 수 있습니다.
편집 3 : 요셉의 대답을 제외한
다른 의견?
질문을 업데이트하고 더 자세한 정보를 제공하십시오. 고객이 귀하의 서비스에 어떻게 연결되어 있습니까? 무엇을 시도 했습니까? –
@Terry Donaghe : 질문의 업데이트를 참조하십시오 – Kamarey